perf: 优化待审批流程数量接口

This commit is contained in:
weifashi 2023-12-29 00:35:35 +08:00
parent 4104dea68e
commit ab0539a263
3 changed files with 34 additions and 7 deletions

View File

@ -1128,5 +1128,27 @@ class ApproveController extends AbstractController
return Base::retSuccess('success', '');
}
/**
* @api {get} api/approve/process/doto 20. 查询需要我审批的流程数量
*
* @apiDescription 需要token身份
* @apiVersion 1.0.0
* @apiGroup approve
* @apiName process__doto
*
* @apiSuccess {Number} ret 返回状态码1正确、0错误
* @apiSuccess {String} msg 返回信息(错误描述)
* @apiSuccess {Object} data 返回数据
*/
public function process__doto()
{
$user = User::auth();
$ret = Ihttp::ihttp_get($this->flow_url.'/api/v1/workflow/process/findTaskTotal?userid='.$user->userid);
$process = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true);
if (!$process || $process['status'] != 200) {
return Base::retError($process['message'] ?? '查询失败');
}
return Base::retSuccess('success', $process['data']);
}
}

View File

@ -150,7 +150,7 @@ services:
approve:
container_name: "dootask-approve-${APP_ID}"
image: "kuaifan/dooapprove:0.0.9"
image: "kuaifan/dooapprove:0.0.10"
environment:
TZ: "${TIMEZONE:-PRC}"
MYSQL_HOST: "${DB_HOST}"

View File

@ -588,14 +588,19 @@ export default {
state.approveUnreadNumber = 0;
} else {
dispatch("call", {
url: 'approve/process/findTask',
data: {
page:1,
page_size: 500,
}
url: 'approve/process/doto'
}).then(({data}) => {
state.approveUnreadNumber = data.total || 0;
}).catch(_ => {});
}).catch(({msg}) => {
if( msg.indexOf("404 not found") !== -1){
$A.modalInfo({
language: false,
title: '版本过低',
content: '服务器版本过低,请升级服务器。',
})
return;
}
});
}
}, typeof timeout === "number" ? timeout : 1000)
},