From 0366140e88af29035dc988c8c20ec2492fd6f644 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 10 Jan 2024 11:50:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/Model/Task.php | 31 ++++++++++++++++++------- application/common/Model/TaskStages.php | 2 +- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/application/common/Model/Task.php b/application/common/Model/Task.php index 50a5c82..22912b0 100755 --- a/application/common/Model/Task.php +++ b/application/common/Model/Task.php @@ -430,6 +430,21 @@ class Task extends CommonModel Db::startTrans(); try { $result = TaskMember::inviteMember($executorCode, $taskCode, 1); + if($task['exchange_list']){ + $exchange_list=explode(',',$task['exchange_list']); + foreach ($exchange_list as $k=>$exchange){ + if($executorCode==$exchange){ + unset($exchange_list[$k]); + } + } + if($exchange_list){ + $task->exchange_list=implode(',',$exchange_list); + $task->save(); + }else{ + $task->exchange_list=''; + $task->save(); + } + } //todo 添加任务动态,编辑权限检测 Db::commit(); } catch (Exception $e) { @@ -497,22 +512,20 @@ class Task extends CommonModel // ]; $comments='comment'; if($type==1){ - $data['status']=2; + $data['status']=2;//进行中 if($task['exchange_list']){ - $code= TaskStages::where('project_code',$task['project_code'])->where('name','已完成')->where('deleted',0)->value('code'); - - $task['transferred'][]=$task['exchange_list'][0]; - $task['assign_to']=$task['exchange_list'][0]; - unset($task['exchange_list'][0]); - $res= self::where('id',$task['id'])->update($data); + $transferred=explode(',',$task['transferred']); + array_push($transferred,$task['exchange_list'][0]); + $data['transferred']=implode(',',$transferred); + $data['assign_to']=$task['exchange_list'][0]; + self::where('id',$task['id'])->update($data); }else{ $code= TaskStages::where('project_code',$task['project_code'])->where('name','已完成')->where('deleted',0)->value('code'); $data['status']=1; $data['done']=1; $data['execute_status']='done'; $data['stage_code']=$code; - - $res= self::name('task')->where('id',$task['id'])->update($data); + self::name('task')->where('id',$task['id'])->update($data); } $comments='pass'; }elseif($type==2){ diff --git a/application/common/Model/TaskStages.php b/application/common/Model/TaskStages.php index 329c872..9b1c3a4 100755 --- a/application/common/Model/TaskStages.php +++ b/application/common/Model/TaskStages.php @@ -94,7 +94,7 @@ class TaskStages extends CommonModel !$joinTaskMember && $taskModel->leftJoin('task_member tm', 't.code = tm.task_code'); $taskModel = $taskModel->whereIn('tm.member_code', $joiner); } - $list = $taskModel->order('t.create_time desc')->field('id', true)->select(); + $list = $taskModel->order('t.create_time desc')->field('id', true)->select(); if ($list) { $taskMemberList = []; foreach ($list as &$task) {