diff --git a/app/Http/Controllers/Api/ProjectController.php b/app/Http/Controllers/Api/ProjectController.php index 65c1a25ee..5c77d2cb8 100755 --- a/app/Http/Controllers/Api/ProjectController.php +++ b/app/Http/Controllers/Api/ProjectController.php @@ -1062,11 +1062,16 @@ public function task__lists() $query->on('project_task_visibility_users.task_id', '=', 'project_tasks.id'); $query->where('project_task_visibility_users.userid', $userid); }); + $builder->leftJoin('project_task_visibility_users as project_sub_task_visibility_users', function ($query) use($userid) { + $query->on('project_sub_task_visibility_users.task_id', '=', 'project_tasks.parent_id'); + $query->where('project_sub_task_visibility_users.userid', $userid); + }); $builder->where(function ($query) use ($userid) { $query->where("project_tasks.visibility", 1); $query->orWhere("project_users.userid", $userid); $query->orWhere("project_task_users.userid", $userid); $query->orWhere("project_task_visibility_users.userid", $userid); + $query->orWhere("project_sub_task_visibility_users.userid", $userid); }); // 优化子查询汇总 $builder->leftJoinSub(function ($query) { diff --git a/app/Observers/ProjectTaskObserver.php b/app/Observers/ProjectTaskObserver.php index d31701e93..f9b796335 100644 --- a/app/Observers/ProjectTaskObserver.php +++ b/app/Observers/ProjectTaskObserver.php @@ -113,7 +113,7 @@ public static function visibilityUpdate(ProjectTask $projectTask) break; case 2: case 3: - $dataType = $projectTask->visibility == 2 ? ['task'] : ['visibility']; + $dataType = $projectTask->visibility == 2 ? ['task'] : ['task', 'visibility']; $forgetUserids = self::userids($projectTask, $dataType); $projectOwnerUserIds = self::userids($projectTask, 'projectOwnerUser'); $recordUserids = array_diff($projectUserids, $forgetUserids, $projectOwnerUserIds); diff --git a/app/Observers/ProjectTaskUserObserver.php b/app/Observers/ProjectTaskUserObserver.php index c4982c27c..33288a78c 100644 --- a/app/Observers/ProjectTaskUserObserver.php +++ b/app/Observers/ProjectTaskUserObserver.php @@ -17,6 +17,9 @@ class ProjectTaskUserObserver public function created(ProjectTaskUser $projectTaskUser) { Deleted::forget('projectTask', $projectTaskUser->task_id, $projectTaskUser->userid); + if ($projectTaskUser->task_pid) { + Deleted::forget('projectTask', $projectTaskUser->task_pid, $projectTaskUser->userid); + } } /**