From 79c1f1d9f22929fadb3e8a06dc0ab8bb040362fb Mon Sep 17 00:00:00 2001 From: CounterFire2023 <136581895+CounterFire2023@users.noreply.github.com> Date: Thu, 29 Jun 2023 19:03:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E4=B8=80=E4=BA=9B=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/chain.controllers.ts | 62 ++++++++++++++-------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/controllers/chain.controllers.ts b/src/controllers/chain.controllers.ts index aaff206..d9162e8 100644 --- a/src/controllers/chain.controllers.ts +++ b/src/controllers/chain.controllers.ts @@ -9,38 +9,38 @@ import { ZError } from 'common/ZError' import { RedisClient } from 'redis/RedisClient' class ChainController extends BaseController { - @role('anon') - @router('post /chain/req') - async addChainRequest(req, res) { - // data是一个数组!! - const { data, source, cb, taskId, force, max } = req.params - console.log(`income chain request:: taskId: ${taskId}, source: ${source}, cb: ${cb}`) - console.log(JSON.stringify(data)) - let maxTryCount = max !== undefined ? parseInt(max) : parseInt(process.env.CHAIN_MAX_TRY) - let chainTask: DocumentType = await ChainTask.insertOrUpdate( - { taskId }, - { source, taskData: data, cb }, - ) + // @role('anon') + // @router('post /chain/req') + // async addChainRequest(req, res) { + // // data是一个数组!! + // const { data, source, cb, taskId, force, max } = req.params + // console.log(`income chain request:: taskId: ${taskId}, source: ${source}, cb: ${cb}`) + // console.log(JSON.stringify(data)) + // let maxTryCount = max !== undefined ? parseInt(max) : parseInt(process.env.CHAIN_MAX_TRY) + // let chainTask: DocumentType = await ChainTask.insertOrUpdate( + // { taskId }, + // { source, taskData: data, cb }, + // ) - if ((!chainTask.newRecord && force) || chainTask.newRecord) { - for (let sub of data) { - let subType = sub.type - let subTask = new RequestTask({ - taskId, - chainTaskId: chainTask.id, - taskType: subType, - reqData: sub, - maxTryCount, - }) - await subTask.save() - chainTask.tasks.pushOnce(subTask.id) - new ChainQueue().addTaskToQueue(subTask) - } - } - chainTask.newRecord = false - await chainTask.save() - return chainTask.toJson() - } + // if ((!chainTask.newRecord && force) || chainTask.newRecord) { + // for (let sub of data) { + // let subType = sub.type + // let subTask = new RequestTask({ + // taskId, + // chainTaskId: chainTask.id, + // taskType: subType, + // reqData: sub, + // maxTryCount, + // }) + // await subTask.save() + // chainTask.tasks.pushOnce(subTask.id) + // new ChainQueue().addTaskToQueue(subTask) + // } + // } + // chainTask.newRecord = false + // await chainTask.save() + // return chainTask.toJson() + // } @role('anon') @router('post /chain/query_info')