Commit 930efdb099988b80b33a1d7fc67253839579ea98

Authored by 宋庆平
1 parent f4900f89

x

Showing 1 changed file with 14 additions and 3 deletions   Show diff stats
wxsdk/wx/WxPay.ts
... ... @@ -22,7 +22,7 @@ export default class WxPay {
22 22 platform,
23 23 offerId: OfferId,
24 24 currencyType: CurrencyType,
25   - buyQuantity: params.money,
  25 + buyQuantity: params.money/10,
26 26 zoneId: ZoneId
27 27 };
28 28 console.log(pms);
... ... @@ -32,7 +32,7 @@ export default class WxPay {
32 32 });
33 33 }
34 34  
35   - private async handlePaySuccess(data: { payid: string, goodid: string, money: number; orderid: string, platform: string }, opts: any, resolve: any, reject: any) {
  35 + private async handlePaySuccess(data: { payid: string, goodid: string, money: number; orderid: string, platform: string }, opts: any, resolve: any, reject: any, t = 1000) {
36 36 // let code = await WxApi.I.login();
37 37  
38 38 let extend = "";
... ... @@ -52,8 +52,19 @@ export default class WxPay {
52 52 money: data.money,
53 53 platform: data.platform
54 54 };
  55 + var that = this;
55 56 SDKApi.pay(params)
56   - .then(ret => resolve(ret))
  57 + .then(res => {
  58 + if (!res.code) {
  59 + resolve(res);
  60 + } else {
  61 + t = Math.min(t * 2, 60000)
  62 + console.error("上报失败,重新上报", t)
  63 + setTimeout(() => {
  64 + that.handlePaySuccess(data, opts, resolve, reject, t)
  65 + }, t);
  66 + }
  67 + })
57 68 .catch(err => this.handlePayError(err, reject));
58 69 }
59 70  
... ...