From d9bcd0fa276e34490104b84b627d56c214621bf0 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Mon, 23 Oct 2023 14:18:05 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=9D=91=E7=AE=A1=E7=90=86=E5=85=AC?= =?UTF-8?q?=E5=8F=B8=E4=BB=BB=E5=8A=A1-=E4=BF=A1=E6=81=AF=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E9=93=BA=E8=AE=BE=E6=8F=90=E4=BA=A4=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/TaskController.php | 59 +++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/app/api/controller/TaskController.php b/app/api/controller/TaskController.php index e0ffe3860..eefa9f98a 100644 --- a/app/api/controller/TaskController.php +++ b/app/api/controller/TaskController.php @@ -44,6 +44,10 @@ class TaskController extends BaseApiController if ($userCompanyInfo['company_type'] == 41) { $where[] = ['director_uid', '=', $this->userId]; +// $where[] = ['company_id', '=', $this->userInfo['company_id']]; + } + if ($userCompanyInfo['company_type'] == 17) { + $where[] = ['director_uid', '=', $this->userId]; // $where[] = ['company_id', '=', $this->userInfo['company_id']]; } if (isset($param['date_time']) && $param['date_time'] != '') { @@ -469,4 +473,59 @@ class TaskController extends BaseApiController } return $this->success('ok', $task); } + + public function commit_village_task_type_6() + { + 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, + 'note' => $parmas['note'], + 'annex' => ['annex'], + 'video_annex' => ['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_5; + $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()); + } + } + }