From 804d1883a9cb54fd05a80ea198c036f7c83ae9a7 Mon Sep 17 00:00:00 2001 From: CounterFire2023 <136581895+CounterFire2023@users.noreply.github.com> Date: Sun, 16 Jul 2023 15:36:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=9F=A5alchmy=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E7=BD=91=E7=BB=9C=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=20=E9=82=A3=E4=B9=88=E9=87=8D=E8=AF=956ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- src/controllers/internal.controller.ts | 7 ++++++- src/modules/PayRecord.ts | 8 +++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.env.development b/.env.development index e3b07e8..c0b7875 100644 --- a/.env.development +++ b/.env.development @@ -42,7 +42,7 @@ AGOR_WALLET='0x50A8e60041A206AcaA5F844a1104896224be6F39' PAY_TRANSFER_CB_URL='http://127.0.0.1:3007/api/internal/update_task' # 链端回调hash的ket HASH_SALT='iG4Rpsa)6U31$H#^T85$^^3' - +HASH_SALT_CHAIN='iG4Rpsa)6U31$H#^T85$^^3' # 游戏服, 支付上报地址 GAME_PAY_CB_URL=https://game2006api-test.kingsome.cn/webapp/index.php REDIS=redis://127.0.0.1:6379/14 diff --git a/src/controllers/internal.controller.ts b/src/controllers/internal.controller.ts index f590937..7691e49 100644 --- a/src/controllers/internal.controller.ts +++ b/src/controllers/internal.controller.ts @@ -11,7 +11,7 @@ import { PriceSvr } from 'service/price.svr' const calcHash = function (data: any) { let signStr = JSON.stringify(data) - return hmacsha256(signStr, process.env.HASH_SALT) + return hmacsha256(signStr, process.env.HASH_SALT_CHAIN) } const notify = async function (record: DocumentType, subTask: DocumentType) { @@ -37,6 +37,11 @@ const notify = async function (record: DocumentType, subTask: Do } } catch (err) { logger.error(`notify alchemy error:: ${err.message}`) + record.notofyErrCount = record.notofyErrCount + 1 + await record.save() + if (record.notofyErrCount < 6) { + await notify(record, subTask) + } } } diff --git a/src/modules/PayRecord.ts b/src/modules/PayRecord.ts index 92f730b..54779ed 100644 --- a/src/modules/PayRecord.ts +++ b/src/modules/PayRecord.ts @@ -60,7 +60,7 @@ export class PayRecordClass extends BaseModule { // 开始创建记录时, 估算的可获取加密货币数量 @prop() - public cryptoAmountEstimate: string + public cryptoAmountEstimate?: string // 加密货币价格 @prop() @@ -107,6 +107,12 @@ export class PayRecordClass extends BaseModule { @prop({ default: 0 }) public tranStatus: number + /** + * 国库模式通知alchemy次数 + */ + @prop({ default: 0 }) + public notofyErrCount: number + /** * 上报游戏服状态 * 0: 未上报