From 412a20186c0cd30abab2eba4a9f70f160a5b2ef0 Mon Sep 17 00:00:00 2001 From: wkj <278599135@.com> Date: Mon, 16 Jun 2025 13:07:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=AE=9D=E7=94=B5=E8=84=91?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E7=94=9F=E6=88=90=E6=94=AF=E4=BB=98=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=20=E8=AE=BE=E7=BD=AEtime=5Fexpire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es/utils/payClazz/AliPay/AliPay.js | 4 +++- lib/triggers/withdraw.d.ts | 2 +- lib/utils/payClazz/AliPay/AliPay.js | 4 +++- src/utils/payClazz/AliPay/AliPay.ts | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/es/utils/payClazz/AliPay/AliPay.js b/es/utils/payClazz/AliPay/AliPay.js index b9a4bc5c..145f0349 100644 --- a/es/utils/payClazz/AliPay/AliPay.js +++ b/es/utils/payClazz/AliPay/AliPay.js @@ -181,6 +181,7 @@ export default class AliPay extends AliPayDebug { const out_trade_no = compressTo32(pay.id); // 支付宝金额单位为元,需要转换 const totalAmount = ToYuan(pay.price); + const timeoutAt = Date.now() + PREPAY_TIMEOUT; switch (this.apProduct.type) { case 'native': { const method = this.apProduct.config?.prepayMethod || 'GET'; @@ -196,6 +197,7 @@ export default class AliPay extends AliPayDebug { notify_url: payNotifyUrl, qr_pay_mode: qrPayMode, qrcode_width: qrCodeWidth, + time_expire: dayJs(timeoutAt).format('yyyy-MM-dd HH:mm:ss'), }, notify_url: payNotifyUrl, needEncrypt: this.needEncrypt, @@ -217,7 +219,7 @@ export default class AliPay extends AliPayDebug { } } // pay加一个过期时间,到期自动close - data.timeoutAt = Date.now() + PREPAY_TIMEOUT; + data.timeoutAt = timeoutAt + 1000 * 60 * 3; } async getState(pay) { const outTradeNo = compressTo32(pay.id); diff --git a/lib/triggers/withdraw.d.ts b/lib/triggers/withdraw.d.ts index e69f8d6e..979a44c8 100644 --- a/lib/triggers/withdraw.d.ts +++ b/lib/triggers/withdraw.d.ts @@ -6,6 +6,6 @@ import { BRC } from '../types/RuntimeCxt'; * @param context * @param refunds */ -export declare function updateWithdrawState(context: BRC, id: string): Promise<0 | 1>; +export declare function updateWithdrawState(context: BRC, id: string): Promise<1 | 0>; declare const triggers: Trigger[]; export default triggers; diff --git a/lib/utils/payClazz/AliPay/AliPay.js b/lib/utils/payClazz/AliPay/AliPay.js index a2188e44..c4bb163c 100644 --- a/lib/utils/payClazz/AliPay/AliPay.js +++ b/lib/utils/payClazz/AliPay/AliPay.js @@ -184,6 +184,7 @@ class AliPay extends AliPay_debug_1.default { const out_trade_no = (0, uuid_1.compressTo32)(pay.id); // 支付宝金额单位为元,需要转换 const totalAmount = (0, money_1.ToYuan)(pay.price); + const timeoutAt = Date.now() + PREPAY_TIMEOUT; switch (this.apProduct.type) { case 'native': { const method = this.apProduct.config?.prepayMethod || 'GET'; @@ -199,6 +200,7 @@ class AliPay extends AliPay_debug_1.default { notify_url: payNotifyUrl, qr_pay_mode: qrPayMode, qrcode_width: qrCodeWidth, + time_expire: (0, dayjs_1.default)(timeoutAt).format('yyyy-MM-dd HH:mm:ss'), }, notify_url: payNotifyUrl, needEncrypt: this.needEncrypt, @@ -220,7 +222,7 @@ class AliPay extends AliPay_debug_1.default { } } // pay加一个过期时间,到期自动close - data.timeoutAt = Date.now() + PREPAY_TIMEOUT; + data.timeoutAt = timeoutAt + 1000 * 60 * 3; } async getState(pay) { const outTradeNo = (0, uuid_1.compressTo32)(pay.id); diff --git a/src/utils/payClazz/AliPay/AliPay.ts b/src/utils/payClazz/AliPay/AliPay.ts index 4d66deeb..16e3ad77 100644 --- a/src/utils/payClazz/AliPay/AliPay.ts +++ b/src/utils/payClazz/AliPay/AliPay.ts @@ -211,6 +211,7 @@ export default class AliPay extends AliPayDebug implements PayClazz { const out_trade_no = compressTo32(pay.id); // 支付宝金额单位为元,需要转换 const totalAmount = ToYuan(pay.price); + const timeoutAt = Date.now() + PREPAY_TIMEOUT; switch (this.apProduct.type!) { case 'native': { const method = this.apProduct.config?.prepayMethod || 'GET'; @@ -226,6 +227,7 @@ export default class AliPay extends AliPayDebug implements PayClazz { notify_url: payNotifyUrl, qr_pay_mode: qrPayMode, qrcode_width: qrCodeWidth, + time_expire: dayJs(timeoutAt).format('yyyy-MM-dd HH:mm:ss'), }, notify_url: payNotifyUrl, needEncrypt: this.needEncrypt, @@ -249,7 +251,7 @@ export default class AliPay extends AliPayDebug implements PayClazz { } } // pay加一个过期时间,到期自动close - data.timeoutAt = Date.now() + PREPAY_TIMEOUT; + data.timeoutAt = timeoutAt + 1000 * 60 * 3; } async getState(pay: OpPay): Promise<[EntityDict['pay']['OpSchema']['iState'], PayUpdateData]> {