line增加执行Hook配置
This commit is contained in:
1 parent
b3eaccc05a
commit
b6ff0d0a5e
5 files changed
+46
-54
No files matched your search
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
const Service = require('egg').Service;
|
||||
|
||||
class HookService extends Service {
|
||||
async executeFinishLine(actionData) {
|
||||
const { taskId } = actionData;
|
||||
// 根据任务ID找到绑定的业务数据,进行处理
|
||||
console.log("审批结束", actionData)
|
||||
}
|
||||
async executeRejectLine(actionData) {
|
||||
console.log("审批拒绝", actionData)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HookService;
|
||||
+11
-1
@@ -344,8 +344,18 @@ class TaskService extends Service {
|
||||
taskConfigId: nextNode.id,
|
||||
taskStatus: (nextLineList.length === 0 || currentNode.id.includes('end-')) ? 'end' : type === 'deny' ? 'deny' : 'running'
|
||||
});
|
||||
await this.executeLineHook(line);
|
||||
}
|
||||
}
|
||||
async executeLineHook(line) {
|
||||
try {
|
||||
const { service, serviceFunction } = JSON.parse(line.hook || '{}');
|
||||
if (service && serviceFunction) {
|
||||
await this.ctx.service[service][serviceFunction](this.ctx.request.body.appData.actionData, this.ctx)
|
||||
}
|
||||
} catch (error) {
|
||||
throw new BizError(errorInfoEnum.line_hook_error);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user