This commit is contained in:
mkm 2024-01-10 11:50:05 +08:00
parent aeab074974
commit 0366140e88
2 changed files with 23 additions and 10 deletions

View File

@ -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){

View File

@ -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) {