request->isPost()){ return $this->fail('请求方式错误'); } $params=$this->request->post(['page_no','page_size','template_id','scheduling_id','status','start_time','end_time']); $where = []; if (isset($params['template_id']) && $params['template_id'] != '') { $where[] = ['template_id', '=', $params['template_id']]; } if (isset($params['scheduling_id']) && $params['scheduling_id'] != '') { $where[] = ['scheduling_id', '=', $params['scheduling_id']]; } if (isset($params['status']) && $params['status'] != '') { $where[] = ['status', '=', $params['status']]; } if (isset($params['start_time']) && $params['start_time'] != '') { $where[] = ['start_time', '>=', strtotime($params['start_time'])]; } if (isset($params['end_time']) && $params['end_time'] != '') { $where[] = ['end_time', '<=', strtotime($params['end_time'])]; } $pageNo = !empty($params['page_no']) ? $params['page_no'] : 1; $pageSize = !empty($params['page_size']) ? $params['page_size'] : 20; $data = TaskSchedulingPlan::where($where) ->with(['template','templateInfo']) ->page($pageNo, $pageSize) ->order(['id' => 'desc']) ->select() ->toArray(); $count = TaskSchedulingPlan::where($where)->count(); $result = [ 'lists' => $data, 'count' => $count, 'page_no' => $pageNo, 'page_size' => $pageSize ]; return $this->success('请求成功',$result); } }