liuyu 4 年之前
父节点
当前提交
1c98b58caa
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      app/service/weixin.js

+ 2 - 2
app/service/weixin.js

@@ -74,8 +74,8 @@ class WeixinAuthService extends AxiosService {
       this.ctx.logger.error(`[WeixinAuthService] fetch userinfo by openid fail, errcode: ${res.errcode}, errmsg: ${res.errmsg}`);
       this.ctx.logger.error(`[WeixinAuthService] fetch userinfo by openid fail, errcode: ${res.errcode}, errmsg: ${res.errmsg}`);
       throw new BusinessError(ErrorCode.SERVICE_FAULT, '获得微信用户信息失败');
       throw new BusinessError(ErrorCode.SERVICE_FAULT, '获得微信用户信息失败');
     }
     }
-    const token = res.access_token;
-    console.log(res);
+    const token = res.data.access_token;
+    console.log(token);
     const urlun = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token=' + token + '&openid=' + openid + '&lang=zh_CN';
     const urlun = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token=' + token + '&openid=' + openid + '&lang=zh_CN';
     const result = await this.ctx.curl(urlun, {
     const result = await this.ctx.curl(urlun, {
       method: 'get',
       method: 'get',