<?php

namespace App\Http\Controllers\API\Admin\YeWu;

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

class healthCalendarController extends Controller
{
    public function getList(Request $request){
        $userid = $request->get('userid');//中间件产生的参数
        $group = $request->get('role');//中间件产生的参数
        $page =request('page');
        $pageSize =request('pageSize');
        $searchInfo=request('searchInfo');
        $s=app()->make(HealthCalendarService::class);
        return  $s->getList(['group'=>$group,'userid'=>$userid,'page'=>$page,'pageSize'=>$pageSize,'searchInfo'=>$searchInfo]);
    }

    //创建日历
    public function CreateCalendar(Request $request){
        $userid = $request->get('userid');//中间件产生的参数
        $group = $request->get('role');//中间件产生的参数
        $info= request('info');
        if($group<>1 and $group<>7) return \Yz::echoError('无此接口访问权限');

        $s=app()->make(HealthCalendarService::class);
        return  $s->CreateCalendar(['info'=>$info,'group'=>$group,'userid'=>$userid]);
    }
    public function Del(Request $request){
        $userid = $request->get('userid');//中间件产生的参数
        $group = $request->get('role');//中间件产生的参数
        $list= request('list');
        $s=app()->make(HealthCalendarService::class);
        return  $s->Del(['list'=>$list,'group'=>$group,'userid'=>$userid]);
    }

    //修改日历信息
    public function ChangeInfo(Request $request){
        $userid = $request->get('userid');//中间件产生的参数
        $group = $request->get('role');//中间件产生的参数
        $changeInfo= request('changeInfo');
        $s=app()->make(HealthCalendarService::class);
        return  $s->ChangeInfo(['changeInfo'=>$changeInfo,'group'=>$group,'userid'=>$userid]);
    }
}
