From d7d8ee481e720624225511e102773d1f2fc68e41 Mon Sep 17 00:00:00 2001 From: weifs <605403358@qq.com> Date: Mon, 29 Apr 2024 20:59:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=20=E4=BF=AE=E5=A4=8D=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E4=B8=AD=E9=80=89=E5=AE=8C=E6=88=90=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E7=A7=BB=E5=8A=A8=E6=B2=A1=E6=9C=89=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=97=B6=E9=97=B4=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/ProjectTask.php | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/app/Models/ProjectTask.php b/app/Models/ProjectTask.php index fa4e2b869..a650ff660 100644 --- a/app/Models/ProjectTask.php +++ b/app/Models/ProjectTask.php @@ -1717,41 +1717,48 @@ public function taskPush($userids, int $type, string $suffix = "") */ public function moveTask(int $projectId, int $columnId,int $flowItemId = 0,array $owner = [], array $assist = []) { - AbstractModel::transaction(function () use($projectId, $columnId, $flowItemId, $owner, $assist) { + AbstractModel::transaction(function () use ($projectId, $columnId, $flowItemId, $owner, $assist) { $newTaskUser = array_merge($owner, $assist); // $this->project_id = $projectId; $this->column_id = $columnId; - $this->flow_item_id = $flowItemId; // 任务内容 - if($this->content){ + if ($this->content) { $this->content->project_id = $projectId; $this->content->save(); } // 任务文件 - foreach ($this->taskFile as $taskFile){ + foreach ($this->taskFile as $taskFile) { $taskFile->project_id = $projectId; $taskFile->save(); } // 任务标签 - foreach ($this->taskTag as $taskTag){ + foreach ($this->taskTag as $taskTag) { $taskTag->project_id = $projectId; $taskTag->save(); } // 任务用户 - $this->updateTask(['owner' => $owner]); - $this->updateTask(['assist' => $assist]); - foreach ($this->taskUser as $taskUser){ - if( in_array($taskUser->id, $newTaskUser) ){ + $this->updateTask([ + 'owner' => $owner, + 'assist' => $assist + ]); + foreach ($this->taskUser as $taskUser) { + if (in_array($taskUser->id, $newTaskUser)) { $taskUser->project_id = $projectId; $taskUser->save(); } } // - if($flowItemId){ + if ($flowItemId) { $flowItem = projectFlowItem::whereProjectId($projectId)->whereId($flowItemId)->first(); + $this->flow_item_id = $flowItemId; $this->flow_item_name = $flowItem->status . "|" . $flowItem->name; - }else{ + if ($flowItem->status == 'end') { + $this->completeTask(Carbon::now(), $flowItem->name); + } else { + $this->completeTask(null); + } + } else { $this->flow_item_name = ''; } //