panhui 3 лет назад
Родитель
Сommit
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) => {
             wx.config({
                 ...res,
-                jsApiList: ['chooseWXPay', 'updateAppMessageShareData', 'updateTimelineShareData']
+                jsApiList: ['chooseWXPay', 'updateAppMessageShareData', 'updateTimelineShareData'],
+                debug: true
             })
             wx.ready(function () {
                 // fetchPay(openid).then((params: any) => {
@@ -56,7 +57,7 @@ if (query.code) {
         })
         .catch(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) {
                     fetchRedirectUrl().then(res => {
                         const str = String(res).replace(