From 3e8e31324cbd53134e8fe483c9a6de137ade41c5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 01 八月 2024 15:38:42 +0800 Subject: [PATCH] Merge branch 'develop' --- src/api/index.js | 21 ++++----------------- 1 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 0dca831..3717fe7 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -103,23 +103,10 @@ wxAccessToken (appId, domain = '') { let _url = domain || window.GLOB.baseurl - return new Promise(resolve => { - if (window.GLOB.accessToken.appId === appId && window.GLOB.accessToken.accessTime && (parseInt(new Date().getTime() / 1000) - window.GLOB.accessToken.accessTime < 30)) { - resolve(window.GLOB.accessToken) - } else { - window.GLOB.accessToken = {appId} - axios({ - url: _url + 'wechat/getaccesstoken', - method: 'post', - data: JSON.stringify({app_id: appId}) - }).then(res => { - if (res.access_token) { - window.GLOB.accessToken.accessTime = parseInt(new Date().getTime() / 1000) - window.GLOB.accessToken.access_token = res.access_token - } - resolve(res) - }) - } + return axios({ + url: _url + 'wechat/getaccesstoken', + method: 'post', + data: JSON.stringify({app_id: appId}) }) } -- Gitblit v1.8.0