|
@@ -42,6 +42,7 @@ class TaskLogic extends BaseLogic |
|
@@ -42,6 +42,7 @@ class TaskLogic extends BaseLogic |
|
42
|
$this->fail('error');
|
42
|
$this->fail('error');
|
|
43
|
}
|
43
|
}
|
|
44
|
$info = $this->getFileUrl($info);
|
44
|
$info = $this->getFileUrl($info);
|
|
|
|
45
|
+ $info['follow'] = $this->getFileUrl($info['follow']);
|
|
45
|
return $this->success($info);
|
46
|
return $this->success($info);
|
|
46
|
}
|
47
|
}
|
|
47
|
|
48
|
|
|
@@ -67,6 +68,15 @@ class TaskLogic extends BaseLogic |
|
@@ -67,6 +68,15 @@ class TaskLogic extends BaseLogic |
|
67
|
}
|
68
|
}
|
|
68
|
return $v;
|
69
|
return $v;
|
|
69
|
}
|
70
|
}
|
|
|
|
71
|
+
|
|
|
|
72
|
+
|
|
|
|
73
|
+ /**
|
|
|
|
74
|
+ * @remark :保存
|
|
|
|
75
|
+ * @name :save
|
|
|
|
76
|
+ * @author :lyh
|
|
|
|
77
|
+ * @method :post
|
|
|
|
78
|
+ * @time :2023/8/23 17:19
|
|
|
|
79
|
+ */
|
|
70
|
public function save($param){
|
80
|
public function save($param){
|
|
71
|
|
81
|
|
|
72
|
DB::beginTransaction();
|
82
|
DB::beginTransaction();
|
|
@@ -97,36 +107,19 @@ class TaskLogic extends BaseLogic |
|
@@ -97,36 +107,19 @@ class TaskLogic extends BaseLogic |
|
97
|
* @author zbj
|
107
|
* @author zbj
|
|
98
|
* @date 2023/4/27
|
108
|
* @date 2023/4/27
|
|
99
|
*/
|
109
|
*/
|
|
100
|
- public function status($id, $status){
|
|
|
|
101
|
- $task = $this->model->read(['id'=>$id]);
|
|
|
|
102
|
- if(!$task){
|
|
|
|
103
|
- $this->fail('任务不存在');
|
|
|
|
104
|
- }
|
|
|
|
105
|
- $manage_ids = Arr::pluck($task['owner'], 'manage_id', 'id');
|
|
|
|
106
|
- if(!in_array(LoginLogic::manage('id'), $manage_ids)){
|
|
|
|
107
|
- $this->fail('非本人任务,不能更新进程');
|
110
|
+ public function status(){
|
|
|
|
111
|
+ $taskOwnerModel = new TaskOwner();
|
|
|
|
112
|
+ $ownerInfo = $taskOwnerModel->read(['task_id'=>$this->param['id'],'manager_id'=>$this->manager['id']]);
|
|
|
|
113
|
+ if($ownerInfo === false){
|
|
|
|
114
|
+ $this->fail('当前工单不属于您');
|
|
108
|
}
|
115
|
}
|
|
109
|
- $task_data = [
|
|
|
|
110
|
- 'id' => $id,
|
|
|
|
111
|
- 'status' => $status,
|
|
|
|
112
|
- ];
|
|
|
|
113
|
-
|
|
|
|
114
|
- //个人任务
|
|
|
|
115
|
- $task_owner_id = array_search(LoginLogic::manage('id'), $manage_ids);
|
|
|
|
116
|
- (new TaskOwnerLogic())->status($task_owner_id, $status);
|
|
|
|
117
|
-
|
|
|
|
118
|
- //一个人开始,任务开始,所有人完成,任务才完成
|
|
|
|
119
|
- $owner_status = TaskOwner::where('task_id', $id)->pluck('status')->toArray();
|
|
|
|
120
|
- //所有都完成
|
|
|
|
121
|
- if(array_sum($owner_status) == count($owner_status) * TaskOwner::STATUS_DOWN){
|
|
|
|
122
|
- $task_data['status'] = Task::STATUS_DOWN;
|
|
|
|
123
|
- $task_data['done_at'] = date('Y-m-d H:i:s');
|
|
|
|
124
|
- }else{
|
|
|
|
125
|
- $task_data['status'] = Task::STATUS_DONGING;
|
|
|
|
126
|
- $task_data['doing_at'] = date('Y-m-d H:i:s');
|
116
|
+ DB::beginTransaction();
|
|
|
|
117
|
+ try {
|
|
|
|
118
|
+ $this->model->edit(['status'=>$this->param['status']],['id'=>$this->param['id']]);
|
|
|
|
119
|
+ $taskOwnerModel->edit(['status'=>$this->param['status']],['task_id'=>$this->param['id']]);
|
|
|
|
120
|
+ }catch (\Exception $e){
|
|
|
|
121
|
+ $this->fail('error');
|
|
127
|
}
|
122
|
}
|
|
128
|
-
|
|
|
|
129
|
- parent::save($task_data);
|
|
|
|
130
|
return $this->success();
|
123
|
return $this->success();
|
|
131
|
}
|
124
|
}
|
|
132
|
|
125
|
|