lrf 1 year ago
parent
commit
21c6e56e1b
1 changed files with 2 additions and 1 deletions
  1. 2 1
      app/controller/weixin.js

+ 2 - 1
app/controller/weixin.js

@@ -70,6 +70,7 @@ class WeixinController extends Controller {
       ({ openid } = await weixin.fetch(code));
     } catch (err) {
       this.ctx.logger.error(err);
+      console.error(err);
       await this.ctx.render('error.njk', { title: err.message, message: err.details });
       return;
     }
@@ -164,7 +165,7 @@ class WeixinController extends Controller {
         }
       } else {
         console.log('rrr0000--->' + redirect_uri);
-        const resunionid = await weixin.fetchUnionID(openid);
+        const resunionid = await this.ctx.service.weixin.fetchUnionID(openid);
         const touri = `${this.app.config.baseUrl}/student/bind`;
         const to_uri = urljoin(touri, `?openid=${openid}&unionid=${resunionid.unionid}`);
         // TODO: 重定性页面