request->isPost()){ return $this->fail('请求方式错误'); } $params=$this->request->post(['page_no','page_size','company_id']); $where = []; if (isset($params['company_id']) && $params['company_id'] != '') { $arr = Company::where('company_name', 'like', '%' . $params['company_id'] . '%')->column('id'); if ($arr) { $where[] = ['company_id', 'in', $arr]; } else { $where[] = ['company_id', 'in', [0]]; } } $pageNo = !empty($params['page_no']) ? $params['page_no'] : 1; $pageSize = !empty($params['page_size']) ? $params['page_size'] : 20; $data = TaskScheduling::where($where) ->with(['admin', 'company', 'company_type']) ->page($pageNo, $pageSize) ->order(['id' => 'desc']) ->select() ->toArray(); $count = TaskScheduling::where($where)->count(); $result = [ 'lists' => $data, 'count' => $count, 'page_no' => $pageNo, 'page_size' => $pageSize ]; return $this->success('请求成功',$result); } /** * @notes 编辑任务公司排期 * @return \think\response\Json * @author likeadmin * @date 2023/08/08 10:08 */ public function edit() { $params = (new TaskSchedulingValidate())->post()->goCheck('edit'); $result = TaskSchedulingLogic::edit($params); if (true === $result) { return $this->success('编辑成功', [], 1, 1); } return $this->fail(TaskSchedulingLogic::getError()); } //编辑金额 public function editMoney() { $params = $this->request->param(); if(empty($params['id'])){ return $this->fail('缺少必要参数id'); } if(empty($params['money'])){ return $this->fail('缺少必要参数金额'); } $moeny = $params['money']; $result = TaskScheduling::where(['id'=>$params['id']])->update(['money'=>$moeny]); if ( $result) { return $this->success('编辑成功', [], 1, 1); } return $this->fail('编辑失败'); } /** * @notes 获取任务公司排期详情 * @return \think\response\Json * @author likeadmin * @date 2023/08/08 10:08 */ public function detail() { $params = (new TaskSchedulingValidate())->post()->goCheck('detail'); $result = TaskSchedulingLogic::detail($params); return $this->data($result); } }