diff --git a/app/api/controller/TaskController.php b/app/api/controller/TaskController.php index 21d8e1afe..7e3343c31 100644 --- a/app/api/controller/TaskController.php +++ b/app/api/controller/TaskController.php @@ -28,30 +28,34 @@ class TaskController extends BaseApiController $time = strtotime(date('Y-m-d')); $userCompanyInfo = Company::where('id', $this->userInfo['company_id'])->find(); $where = []; - - if ($userCompanyInfo['company_type'] == 18) { - $is_captain = User::where('id', $this->userId)->value('is_captain'); - if ($is_captain == 1) { - $where[] = ['type', 'in', [31,33]]; - } + // 公司负责人直接看公司的全部任务 + if ($this->userInfo['admin_id'] != 0) { + $where[] = ['company_id', '=', $this->userInfo['company_id']]; + } else { + // 其他角色看个人的任务 + if ($userCompanyInfo['company_type'] == 18) { + $is_captain = User::where('id', $this->userId)->value('is_captain'); + if ($is_captain == 1) { + $where[] = ['type', 'in', [31,33]]; + } // else { // $where[] = ['type', '=', 33]; // $where[] = ['director_uid', '=', $this->userId]; // } - $where[] = ['company_id', '=', $this->userInfo['company_id']]; + $where[] = ['company_id', '=', $this->userInfo['company_id']]; + } + + if ($userCompanyInfo['company_type'] == 16) { + $where[] = ['director_uid', '=', $this->userId]; +// $where[] = ['company_id', '=', $this->userInfo['company_id']]; + } + if ($userCompanyInfo['company_type'] == 17) { + $where[] = ['director_uid', '=', $this->userId]; +// $where[] = ['company_id', '=', $this->userInfo['company_id']]; + } } - if ($userCompanyInfo['company_type'] == 16) { - $where[] = ['director_uid', '=', $this->userId]; -// $where[] = ['company_id', '=', $this->userInfo['company_id']]; - } - if ($userCompanyInfo['company_type'] == 17) { - $where[] = ['director_uid', '=', $this->userId]; -// $where[] = ['company_id', '=', $this->userInfo['company_id']]; - } - if ($this->userInfo['admin_id'] != 0) { - $where = ['company_id', '=', $this->userInfo['company_id']]; - } + if (isset($param['date_time']) && $param['date_time'] != '') { $time = strtotime($param['date_time']); $param['start_time']=date('Y-m-d H:i:s',$time);