update 村管理公司任务-信息平台铺设提交接口

This commit is contained in:
chenbo 2023-10-23 14:18:05 +08:00
parent 00f49b08f0
commit d9bcd0fa27

View File

@ -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());
}
}
}