From cda01503f7c67d2ed9a89abc5fcc11e6c08f15a0 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Tue, 24 Oct 2023 10:03:49 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=9D=91=E5=85=AC=E5=8F=B8=E4=BB=BB?= =?UTF-8?q?=E5=8A=A16=E6=8F=90=E4=BA=A4=E6=8E=A5=E5=8F=A3=20add=20?= =?UTF-8?q?=E6=9D=91=E5=85=AC=E5=8F=B8=E4=BB=BB=E5=8A=A18=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=BD=93=E5=A4=A9=E6=9C=89?= =?UTF-8?q?=E4=B8=B4=E6=97=B6=E4=BB=BB=E5=8A=A1=E7=9A=84=E8=AF=9D=EF=BC=8C?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E4=B8=8A=E4=BC=A0=E5=AE=8C=E6=88=90=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=87=AD=E8=AF=81=EF=BC=8C=E7=BB=8F=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=E9=80=9A=E8=BF=87=E5=90=8E=E6=89=8D=E5=8F=91?= =?UTF-8?q?=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/TaskController.php | 55 ++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) 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()); } } - }