lrf402788946 4 years ago
parent
commit
cdeec49494
1 changed files with 8 additions and 8 deletions
  1. 8 8
      app/service/weixin.js

+ 8 - 8
app/service/weixin.js

@@ -106,14 +106,14 @@ class WeixinAuthService extends AxiosService {
     const { appid, appSecret } = this.wxInfo;
     if (!jsapi_ticket) {
       // 1,获取access_token
-      let access_token = await this.app.redis.get(this.access_tokenKey);
-      if (!access_token) {
-        // 没有就重新请求
-        const atUrl = `https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=${appid}&secret=${appSecret}`;
-        const req = await this.ctx.curl(atUrl, { method: 'GET', dataType: 'json' });
-        if (req.status !== 200) throw new BusinessError(ErrorCode.SERVICE_FAULT, 'access_token获取失败');
-        access_token = _.get(req, 'data.access_token');
-      }
+      // let access_token = await this.app.redis.get(this.access_tokenKey);
+      // if (!access_token) {
+      // 没有就重新请求
+      const atUrl = `https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=${appid}&secret=${appSecret}`;
+      const req = await this.ctx.curl(atUrl, { method: 'GET', dataType: 'json' });
+      if (req.status !== 200) throw new BusinessError(ErrorCode.SERVICE_FAULT, 'access_token获取失败');
+      const access_token = _.get(req, 'data.access_token');
+      // }
       // 2,获取jsapi_token
       const jtUrl = `https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=${access_token}&type=jsapi`;
       const jtReq = await this.ctx.curl(jtUrl, { method: 'GET', dataType: 'json' });