panhui 3 سال پیش
والد
کامیت
f87f9d450f
1فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 3 2
      src/main.ts

+ 3 - 2
src/main.ts

@@ -29,7 +29,8 @@ if (query.code) {
         .then((res: any) => {
         .then((res: any) => {
             wx.config({
             wx.config({
                 ...res,
                 ...res,
-                jsApiList: ['chooseWXPay', 'updateAppMessageShareData', 'updateTimelineShareData']
+                jsApiList: ['chooseWXPay', 'updateAppMessageShareData', 'updateTimelineShareData'],
+                debug: true
             })
             })
             wx.ready(function () {
             wx.ready(function () {
                 // fetchPay(openid).then((params: any) => {
                 // fetchPay(openid).then((params: any) => {
@@ -56,7 +57,7 @@ if (query.code) {
         })
         })
         .catch(e => {
         .catch(e => {
             console.log(e)
             console.log(e)
-            if (e.message.indexOf('code been used') !== -1) {
+            if (e.message.indexOf('code been used') !== -1 || e.message.indexOf('invalid code') !== -1) {
                 if (isWechat) {
                 if (isWechat) {
                     fetchRedirectUrl().then(res => {
                     fetchRedirectUrl().then(res => {
                         const str = String(res).replace(
                         const str = String(res).replace(