- 暂停Supervisor守护进程;
- 打开项目目录中Http/Service/Approve/ApproveApplyService.php文件;
- 311~397行替换为如下内容:
/**
* 审批.
* @param $id
* @param $status
* @return mixed
* @throws \ReflectionException
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function verifyApply($id, $status)
{
$this->getCardId();
if (!in_array($id, $this->getUsableApprove())) {
throw $this->exception('您暂时没有操作权限');
}
$entId = $this->entId(false);
$uuid = $this->uuId(false);
$applyInfo = $this->dao->get(['id' => $id]);
$ruleInfo = app()->get(ApproveRuleService::class)->get(['approve_id' => $applyInfo->approve_id]);
$approveUserService = app()->get(ApproveUserService::class);
$userInfo = toArray($approveUserService->get(['node_id' => $applyInfo->node_id, 'card_id' => $this->cardId, 'apply_id' => $id, 'status' => 0]));
if (!$userInfo) {
return true;
}
if ($status) {
$this->autoApply($ruleInfo, $approveUserService, $id, $applyInfo, $userInfo);
//1、或签;2、会签;3、依次审批;(0、无此条件)
switch ($userInfo['process_info']['examine_mode']) {
case 1:
if ($approveUserService->exists(['apply_id' => $id, 'level' => $userInfo['level'] + 1])) {
$approveUserService->update([
'apply_id' => $id,
'card_id' => $this->cardId,
'types' => 1,
'node_id' => $applyInfo->node_id,
], [
'verify' => 1,
'status' => 1,
]);
$edit['node_id'] = $this->checkNextNode($approveUserService, $id, $userInfo['level'], $userInfo['sort'], $applyInfo->node_id, false);
$this->dao->update(['id' => $id], $edit);
} else {
$this->dao->update(['id' => $id], ['status' => 1]);
}
break;
case 2:
case 3:
if (!$approveUserService->exists(['apply_id' => $id, 'node_id' => $applyInfo->node_id, 'types' => 1, 'status' => 0])) {
if (!$approveUserService->exists(['apply_id' => $id, 'level_gt' => $userInfo['level'], 'types' => 1])) {
$edit['status'] = 1;
}
$edit['node_id'] = $this->checkNextNode($approveUserService, $id, $userInfo['level'], $userInfo['sort'], $applyInfo->node_id);
$this->dao->update(['id' => $id], $edit);
}
break;
}
} else {
$approveUserService->update(['apply_id' => $id, 'node_id' => $applyInfo->node_id, 'card_id' => $this->cardId, 'types' => 1], ['verify' => 1, 'status' => 2]);
$this->dao->update(['id' => $id], ['status' => 2]);
}
$res = $edit['node_id'] ?? true;
Cache::tags(['approve_apply_' . $entId, 'approve_search_' . $entId, 'approve_apply_detail_' . $entId])->flush();
$userId = uuid_to_uid((string)$uuid, $entId);
//【业务类型】审批提醒
event('business.approval.remind', [$entId, $userId, $id]);
$resStatus = $this->dao->value(['id' => $id], 'status');
switch ($resStatus) {
case 1:
//申请人【业务类型】审批通过提醒
event('business.adoptApply.remind', [$entId, $userId, $id]);
break;
case 2:
//【业务类型】未通过审批醒
event('business.fail.remind', [$entId, $userId, $id]);
break;
}
return $res;
}
4.保存文件并重启Supervisor守护进程。