通知alchmy时,如果网络问题, 那么重试6ci

This commit is contained in:
CounterFire2023 2023-07-16 15:36:11 +08:00
parent a71402dcbc
commit 804d1883a9
3 changed files with 14 additions and 3 deletions

View File

@ -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

View File

@ -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<PayRecordClass>, subTask: DocumentType<TransferRecordClass>) {
@ -37,6 +37,11 @@ const notify = async function (record: DocumentType<PayRecordClass>, 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)
}
}
}

View File

@ -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: 未上报