fixed 市场部长任务10接口

This commit is contained in:
chenbo 2023-11-11 13:49:03 +08:00
parent dd880d2d0e
commit 0d0d0a7e17

View File

@ -415,51 +415,44 @@ class TaskController extends BaseApiController
$extend = []; $extend = [];
$stage = $parmas['stage']; // 当前做的是任务第几阶段 $stage = $parmas['stage']; // 当前做的是任务第几阶段
if ($stage == 1) { if ($stage == 1) {
$parmas['stage1']['is_commit'] = 1;
$extend['stage1'] = $parmas['stage1']; $extend['stage1'] = $parmas['stage1'];
$parmas['stage1']['is_commit'] = 1;
} }
if ($stage == 2) { if ($stage == 2) {
$extend['stage2']['is_commit'] = 1;
$extend['stage2'] = $parmas['stage2']; $extend['stage2'] = $parmas['stage2'];
$extend['stage2']['is_commit'] = 1;
} }
if ($stage == 3) { if ($stage == 3) {
$extend['stage3']['is_commit'] = 1;
$extend['stage3'] = $parmas['stage3']; $extend['stage3'] = $parmas['stage3'];
$extend['stage3']['is_commit'] = 1;
} }
if ($stage == 4) { if ($stage == 4) {
$extend['stage4']['is_commit'] = 1;
$extend['stage4'] = $parmas['stage4']; $extend['stage4'] = $parmas['stage4'];
$extend['stage4']['is_commit'] = 1;
} }
$extend['stage'] = $stage; $extend['stage'] = $stage;
Task::where(['id' => $parmas['id']])->update(['extend' => json_encode($extend), 'update_time'=>time(), 'director_uid'=>$this->userId]); // director_uid 指派人 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'); $areaManagerId = User::where(['id' => $this->userId])->with('company')->value('area_manager');
// 没有则创建审批任务 // 创建审批任务
$approveModel = Approve::where(['task_id' => $task['id']])->findOrEmpty(); $approveModel = new Approve();
if ($approveModel->isEmpty()) { $approveModel->type = Approve::APPROVE_TYPE_4;
$approveModel->type = Approve::APPROVE_TYPE_4; $approveModel->flow_id = 1;
$approveModel->flow_id = 1; $approveModel->name = $task['title'];
$approveModel->name = $task['title']; $approveModel->admin_id = 0; // 后台发起人id 暂时为0
$approveModel->admin_id = 0; // 后台发起人id 暂时为0 $approveModel->user_id = $this->userId; // 前台发起人用户id
$approveModel->user_id = $this->userId; // 前台发起人用户id $approveModel->task_id = $task['id']; // 任务id
$approveModel->task_id = $task['id']; // 任务id $approveModel->department_id = '0';
$approveModel->department_id = '0'; $approveModel->check_admin_ids = $areaManagerId; // 当前审批人ID 片区经理的admin_id
$approveModel->check_admin_ids = $areaManagerId; // 当前审批人ID 片区经理的admin_id $approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核 $approveModel->other_type = 6;
$approveModel->other_type = 6; $approveModel->extend = json_encode($extend);
$approveModel->extend = json_encode($extend); $approveModel->create_time = time();
$approveModel->create_time = time(); $approveModel->update_time = time();
$approveModel->update_time = time(); $re = $approveModel->save();
$re = $approveModel->save();
} else {
// 有则更新状态
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
$approveModel->save();
}
return $this->success('ok', []); return $this->success('ok', []);
} catch (Exception $e) { } catch (Exception $e) {
return $this->fail($e->getMessage()); return $this->fail($e->getMessage());
@ -470,7 +463,7 @@ class TaskController extends BaseApiController
{ {
$parmas = $this->request->param(); $parmas = $this->request->param();
$task = TaskLogic::detail($parmas); $task = TaskLogic::detail($parmas);
$approve = Approve::where(['task_id' =>$task['id']])->find(); $approve = Approve::where(['task_id' =>$task['id']])->order('id', 'desc')->find();
if ($approve) { if ($approve) {
$task['approve_status'] = $approve['check_status']; //审核状态 $task['approve_status'] = $approve['check_status']; //审核状态
$task['deny_notes'] = $approve['remark']; // 拒绝原因 $task['deny_notes'] = $approve['remark']; // 拒绝原因