diff --git a/wxsdk/wx/WxPay.ts b/wxsdk/wx/WxPay.ts index 4e39c9e..0174321 100644 --- a/wxsdk/wx/WxPay.ts +++ b/wxsdk/wx/WxPay.ts @@ -22,7 +22,7 @@ export default class WxPay { platform, offerId: OfferId, currencyType: CurrencyType, - buyQuantity: params.money, + buyQuantity: params.money/10, zoneId: ZoneId }; console.log(pms); @@ -32,7 +32,7 @@ export default class WxPay { }); } - private async handlePaySuccess(data: { payid: string, goodid: string, money: number; orderid: string, platform: string }, opts: any, resolve: any, reject: any) { + private async handlePaySuccess(data: { payid: string, goodid: string, money: number; orderid: string, platform: string }, opts: any, resolve: any, reject: any, t = 1000) { // let code = await WxApi.I.login(); let extend = ""; @@ -52,8 +52,19 @@ export default class WxPay { money: data.money, platform: data.platform }; + var that = this; SDKApi.pay(params) - .then(ret => resolve(ret)) + .then(res => { + if (!res.code) { + resolve(res); + } else { + t = Math.min(t * 2, 60000) + console.error("上报失败,重新上报", t) + setTimeout(() => { + that.handlePaySuccess(data, opts, resolve, reject, t) + }, t); + } + }) .catch(err => this.handlePayError(err, reject)); } -- libgit2 0.21.0