From 6948958cf3c73bd8f90dee045e4a3032e540e717 Mon Sep 17 00:00:00 2001 From: zhl Date: Wed, 5 Apr 2023 17:42:53 +0800 Subject: [PATCH] add post of workflow notify --- src/controllers/workflow.controller.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/controllers/workflow.controller.ts b/src/controllers/workflow.controller.ts index cd929b1..0508e1e 100644 --- a/src/controllers/workflow.controller.ts +++ b/src/controllers/workflow.controller.ts @@ -24,4 +24,18 @@ class WorkFlowController extends BaseController { const { message, id } = decrypt(AES_KEY, echostr) res.send(message) } + + @role('anon') + @router('post /workflow/notify') + async flowNotify(req, res) { + let { msg_signature, timestamp, nonce, echostr } = req.params + const signature = getSignature(TOKEN, timestamp, nonce, echostr) + if (msg_signature !== signature) { + throw new ZError(10, 'params mismatch') + } + const { message, id } = decrypt(AES_KEY, echostr) + console.log(id) + console.log(message) + res.send('success') + } }