lrf402788946 4 سال پیش
والد
کامیت
a39e185375
1فایلهای تغییر یافته به همراه2 افزوده شده و 0 حذف شده
  1. 2 0
      app/service/weixin.js

+ 2 - 0
app/service/weixin.js

@@ -46,12 +46,14 @@ class WeixinAuthService extends AxiosService {
    */
   async authBack(query) {
     const { code, state } = query;
+    console.log(JSON.stringify(query));
     if (!code) throw new BusinessError(ErrorCode.SERVICE_FAULT, '授权未成功');
     const { appid, appSecret } = this.wxInfo;
     const url = ` https://api.weixin.qq.com/sns/oauth2/access_token?appid=${appid}&secret=${appSecret}&code=${code}&grant_type=authorization_code`;
     const req = this.ctx.curl(url, { method: 'GET' });
     if (req.status !== 200) throw new BusinessError(ErrorCode.SERVICE_FAULT, 'openid获取失败');
     const openid = _.get(req, 'data.openid');
+    console.log(`openid=>${openid}`);
     if (!openid) {
       this.ctx.logger.error(JSON.stringify(req.data));
       throw new BusinessError(ErrorCode.SERVICE_FAULT, '未获取到openid');