lrf402788946 há 4 anos atrás
pai
commit
ed67f81e9c
2 ficheiros alterados com 4 adições e 0 exclusões
  1. 1 0
      app/controller/weixin.js
  2. 3 0
      app/service/weixin.js

+ 1 - 0
app/controller/weixin.js

@@ -203,6 +203,7 @@ class WeixinController extends Controller {
   // GET 签到小程序请求用户
   async appAuth() {
     const { js_code, login = true } = this.ctx.query;
+    console.warn(`js_code=>${js_code}`);
     const appopenid = await this.ctx.service.weixin.appAuth(js_code);
     if (!login) this.ctx.ok(appopenid);
     const res = await this.findByAppOpenid(appopenid);

+ 3 - 0
app/service/weixin.js

@@ -288,12 +288,15 @@ class WeixinAuthService extends AxiosService {
       query = `${query}&${key}=${wxapp[key]}`;
     }
     url = `${url}${query}`;
+    console.warn(`url=>${url}`);
     const res = await this.ctx.curl(url, {
       method: 'get',
       headers: {
         'content-type': 'application/json',
       },
     });
+    console.warn('res=>');
+    console.warn(res);
     const { openid } = res.data;
     if (!openid) throw new BusinessError(ErrorCode.BUSINESS, '未获取到openid', '未获取到openid');
     return openid;