diff --git a/app/api/controller/TaskController.php b/app/api/controller/TaskController.php index eefa9f98a..0a0a24595 100644 --- a/app/api/controller/TaskController.php +++ b/app/api/controller/TaskController.php @@ -486,6 +486,60 @@ class TaskController extends BaseApiController $this->fail('没有上传凭证,无法提交审核'); } + $extend = [ + 'other'=> [ + 'is_commit' => 1, + 'note' => $parmas['note'], + 'annex' => $parmas['annex'], + 'video_annex' => $parmas['video_annex'], + ] + ]; + Task::where(['id' => $parmas['id']])->update(['extend' => json_encode($extend), 'update_time'=>time(), 'director_uid'=>$this->userId]); // director_uid 指派人 + + // 片区经理 + $areaManagerId = User::where(['id' => $this->userId])->with('company')->value('area_manager'); + + + // 没有则创建审批任务 + $approveModel = Approve::where(['task_id' => $task['id']])->findOrEmpty(); + if ($approveModel->isEmpty()) { + $approveModel->type = Approve::APPROVE_TYPE_6; + $approveModel->flow_id = 1; + $approveModel->name = $task['title']; + $approveModel->admin_id = 0; // 后台发起人id 暂时为0 + $approveModel->user_id = $this->userId; // 前台发起人用户id + $approveModel->task_id = $task['id']; // 任务id + $approveModel->department_id = '0'; + $approveModel->check_admin_ids = $areaManagerId; // 当前审批人ID 片区经理的admin_id + $approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核 + $approveModel->other_type = 6; + $approveModel->extend = json_encode($extend); + $approveModel->create_time = time(); + $approveModel->update_time = time(); + $re = $approveModel->save(); + } else { + // 有则更新状态 + $approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核 + $approveModel->save(); + } + return $this->success('ok', []); + } catch (Exception $e) { + return $this->fail($e->getMessage()); + } + } + + public function commit_village_task_type_8() + { + try { + $parmas = $this->request->param(); // id annex video_annex + $task = TaskLogic::detail($parmas); + if (empty($task)) { + $this->fail('任务不存在'); + } + if (empty($parmas['annex']) && empty($parmas['video_annex'])) { + $this->fail('没有上传凭证,无法提交审核'); + } + $extend = [ 'other'=> [ 'is_commit' => 1, @@ -527,5 +581,4 @@ class TaskController extends BaseApiController return $this->fail($e->getMessage()); } } - }