<?php

namespace App\Http\Controllers\API\H5;

use App\Http\Controllers\Controller;
use App\Services\Admin\YeWu\PlanListService;
use Illuminate\Http\Request;

class PlanController extends Controller
{
    public function GetEnablePlan(Request $request)
    {
        $regnum = request('regnum');
        $entrustid = request('entrustid');
        $episodeid = request('episodeid');
        $appointment_type = request('appointment_type'); //预约类型
        $appointment_date = request('date'); //预约日期
        $userid = $request->get('userid');//中间件产生的参数
        $service = new PlanListService();
        return  $service->GetEnablePlan($userid,$entrustid,$episodeid,$appointment_type,$appointment_date);
    }
    public function H5_YuYue()
    {
        $p=[
            'planid'=>request('planid'),
            'appointment_type'=>request('appointment_type'),//渠道id
            'mainlistid'=>request('mainlistid'),
            'do_type'=>request('do_type'),//操作类型,1预约，2改约
        ];
        foreach ($p as $key=>$value){
            if(!isset($value)){
                return \Yz::echoError1('参数：'.$key.' 不能为空');
            }
        }

        $service = new PlanListService();
        return  $service->YuYue($p['planid'],$p['appointment_type'],$p['mainlistid'],$p['do_type']);
    }
    public function H5_CancelYuYue(Request $request)
    {
        $userid = $request->get('userid');//中间件产生的参数
        $MainListId = request('MainListId');
        $service = new PlanListService();
        return  $service->CancelYuYue($MainListId,$userid);
    }
}
