Merge pull request '管理员可看所有任务' (#184) from preview into master

Reviewed-on: #184
This commit is contained in:
mkm 2023-12-18 10:58:29 +08:00
commit b92e51c2e2

View File

@ -28,30 +28,34 @@ class TaskController extends BaseApiController
$time = strtotime(date('Y-m-d')); $time = strtotime(date('Y-m-d'));
$userCompanyInfo = Company::where('id', $this->userInfo['company_id'])->find(); $userCompanyInfo = Company::where('id', $this->userInfo['company_id'])->find();
$where = []; $where = [];
// 公司负责人直接看公司的全部任务
if ($userCompanyInfo['company_type'] == 18) { if ($this->userInfo['admin_id'] != 0) {
$is_captain = User::where('id', $this->userId)->value('is_captain'); $where[] = ['company_id', '=', $this->userInfo['company_id']];
if ($is_captain == 1) { } else {
$where[] = ['type', 'in', [31,33]]; // 其他角色看个人的任务
} 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 { // else {
// $where[] = ['type', '=', 33]; // $where[] = ['type', '=', 33];
// $where[] = ['director_uid', '=', $this->userId]; // $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'] != '') { if (isset($param['date_time']) && $param['date_time'] != '') {
$time = strtotime($param['date_time']); $time = strtotime($param['date_time']);
$param['start_time']=date('Y-m-d H:i:s',$time); $param['start_time']=date('Y-m-d H:i:s',$time);