lrf402788946 4 years ago
parent
commit
734a3df1a8
1 changed files with 2 additions and 1 deletions
  1. 2 1
      app/service/weixin.js

+ 2 - 1
app/service/weixin.js

@@ -79,6 +79,7 @@ class WeixinAuthService extends AxiosService {
       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' });
       if (jtReq.status !== 200) throw new BusinessError(ErrorCode.SERVICE_FAULT, 'jsapi_ticket获取失败');
+      console.log(jtReq);
       jsapi_ticket = _.get(jtReq, 'data.ticket');
       // 实际过期时间是7200s(2h),系统默认设置6000s
       const expiresIn = _.get(jtReq, 'data.expires_in', 6000);
@@ -89,7 +90,7 @@ class WeixinAuthService extends AxiosService {
     const timestamp = new Date().getTime();
     const signStr = `jsapi_ticket=${jsapi_ticket}&noncestr=${noncestr}&timestamp=${timestamp}&url=${url}`;
     const sign = crypto.createHash('sha1').update(signStr).digest('hex');
-    return { jsapi_ticket, noncestr, timestamp, sign, sign, appid };
+    return { jsapi_ticket, noncestr, timestamp, sign, appid };
   }