Jelajahi Sumber

修复任务负责人无法修改不在项目里的任务

kuaifan 5 tahun lalu
induk
melakukan
0c84da585e
1 mengubah file dengan 8 tambahan dan 6 penghapusan
  1. 8 6
      app/Http/Controllers/Api/ProjectController.php

+ 8 - 6
app/Http/Controllers/Api/ProjectController.php

@@ -1115,21 +1115,21 @@ class ProjectController extends Controller
         }
         //
         $taskid = intval(Request::input('taskid'));
-        $isowner = false;
+        $isOwner = false;
         if ($taskid > 0) {
             $taskDetail = Base::DBC2A(DB::table('project_task')->where('id', $taskid)->first());
             if (empty($taskDetail)) {
                 return Base::retError('任务不存在!');
             }
             if ($taskDetail['username'] == $user['username']) {
-                $isowner = true;
+                $isOwner = true;
             }
             $projectid = $taskDetail['projectid'];
         } else {
             $projectid = intval(Request::input('projectid'));
         }
         //
-        if ($projectid > 0 && !$isowner) {
+        if ($projectid > 0 && !$isOwner) {
             $inRes = Project::inThe($projectid, $user['username']);
             if (Base::isError($inRes)) {
                 return $inRes;
@@ -1463,9 +1463,11 @@ class ProjectController extends Controller
             return Base::retError('任务不存在!');
         }
         if ($task['projectid'] > 0) {
-            $inRes = Project::inThe($task['projectid'], $user['username']);
-            if (Base::isError($inRes)) {
-                return $inRes;
+            if ($task['username'] != $user['username']) {
+                $inRes = Project::inThe($task['projectid'], $user['username']);
+                if (Base::isError($inRes)) {
+                    return $inRes;
+                }
             }
             if (!in_array($act, ['comment', 'attention'])) {
                 $checkRole = Project::role('edit_role', $task['projectid'], $task['id']);