Bläddra i källkod

先绑定公众号才能绑定

laiguoran 4 år sedan
förälder
incheckning
b39d31c938
1 ändrade filer med 4 tillägg och 1 borttagningar
  1. 4 1
      app/controller/wechat_controller.js

+ 4 - 1
app/controller/wechat_controller.js

@@ -105,7 +105,10 @@ module.exports = app => {
                 if (wxAccountData) {
                     throw '该微信号已绑定过本项目账号';
                 }
-                const user = await app.wechat.oauth.getUser(ctx.session.wechatToken.openid);
+                const user = await app.wechat.api.getUser(ctx.session.wechatToken.openid);
+                if (user.subscribe === 0) {
+                    throw '先关注公众号才能绑定项目';
+                }
 
                 const result2 = await ctx.service.projectAccount.bindWx(accountData.id, ctx.session.wechatToken.openid, user.nickname);
                 if (!result2) {