mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-17 06:32:51 +00:00
perf 工作流接口优化
This commit is contained in:
parent
5923b6169a
commit
cab81c5c04
@ -9,8 +9,9 @@ use App\Models\User;
|
|||||||
use App\Module\Base;
|
use App\Module\Base;
|
||||||
use App\Module\Ihttp;
|
use App\Module\Ihttp;
|
||||||
use App\Models\WebSocketDialog;
|
use App\Models\WebSocketDialog;
|
||||||
use App\Models\WebSocketDialogMsg;
|
|
||||||
use App\Models\WorkflowProcMsg;
|
use App\Models\WorkflowProcMsg;
|
||||||
|
use App\Exceptions\ApiException;
|
||||||
|
use App\Models\WebSocketDialogMsg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @apiDefine workflow
|
* @apiDefine workflow
|
||||||
@ -131,16 +132,16 @@ class WorkflowController extends AbstractController
|
|||||||
$process = $this->getProcessById($process['id']); //获取最新的流程信息
|
$process = $this->getProcessById($process['id']); //获取最新的流程信息
|
||||||
if ($process['candidate']) {
|
if ($process['candidate']) {
|
||||||
$userid = explode(',', $process['candidate']);
|
$userid = explode(',', $process['candidate']);
|
||||||
$toUser = User::whereIn('userid', $userid)->get();
|
$toUser = User::whereIn('userid', $userid)->get()->toArray();
|
||||||
$botUser = User::botGetOrCreate('approval-alert');
|
$botUser = User::botGetOrCreate('approval-alert');
|
||||||
if (empty($botUser)) {
|
if (empty($botUser)) {
|
||||||
return Base::retError('审批机器人不存在');
|
return Base::retError('审批机器人不存在');
|
||||||
}
|
}
|
||||||
foreach ($toUser as $val) {
|
foreach ($toUser as $val) {
|
||||||
if ($val->bot) {
|
if ($val['bot']) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$dialog = WebSocketDialog::checkUserDialog($botUser, $val->userid);
|
$dialog = WebSocketDialog::checkUserDialog($botUser, $val['userid']);
|
||||||
if (empty($dialog)) {
|
if (empty($dialog)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -435,7 +436,7 @@ class WorkflowController extends AbstractController
|
|||||||
$proc_msg = new WorkflowProcMsg();
|
$proc_msg = new WorkflowProcMsg();
|
||||||
$proc_msg->proc_inst_id = $process['id'];
|
$proc_msg->proc_inst_id = $process['id'];
|
||||||
$proc_msg->msg_id = $msg['data']->id;
|
$proc_msg->msg_id = $msg['data']->id;
|
||||||
$proc_msg->userid = $toUser->userid;
|
$proc_msg->userid = $toUser['userid'];
|
||||||
$proc_msg->save();
|
$proc_msg->save();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -448,7 +449,7 @@ class WorkflowController extends AbstractController
|
|||||||
$process = Ihttp::ihttp_get($this->flow_url."/api/v1/workflow/process/findById?".http_build_query($data));
|
$process = Ihttp::ihttp_get($this->flow_url."/api/v1/workflow/process/findById?".http_build_query($data));
|
||||||
$process = json_decode($process['ret'] == 1 ? $process['data'] : '{}', true);
|
$process = json_decode($process['ret'] == 1 ? $process['data'] : '{}', true);
|
||||||
if (!$process || $process['status'] != 200) {
|
if (!$process || $process['status'] != 200) {
|
||||||
return Base::retError($process['message'] ?? '查询失败');
|
throw new ApiException($process['message'] ?? '查询失败');
|
||||||
}
|
}
|
||||||
return Base::arrayKeyToUnderline($process['data']);
|
return Base::arrayKeyToUnderline($process['data']);
|
||||||
}
|
}
|
||||||
@ -476,7 +477,7 @@ class WorkflowController extends AbstractController
|
|||||||
$process = Ihttp::ihttp_get($this->flow_url."/api/v1/workflow/identitylink/findParticipant?".http_build_query($data));
|
$process = Ihttp::ihttp_get($this->flow_url."/api/v1/workflow/identitylink/findParticipant?".http_build_query($data));
|
||||||
$process = json_decode($process['ret'] == 1 ? $process['data'] : '{}', true);
|
$process = json_decode($process['ret'] == 1 ? $process['data'] : '{}', true);
|
||||||
if (!$process || $process['status'] != 200) {
|
if (!$process || $process['status'] != 200) {
|
||||||
return Base::retError($process['message'] ?? '查询失败');
|
throw new ApiException($process['message'] ?? '查询失败');
|
||||||
}
|
}
|
||||||
return $process;
|
return $process;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user