liuyu 5 năm trước cách đây
mục cha
commit
515cf45d84
1 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 4 4
      app/controller/weixin.js

+ 4 - 4
app/controller/weixin.js

@@ -77,7 +77,7 @@ class WeixinController extends Controller {
       const val = await this.app.redis.get(key);
       const val = await this.app.redis.get(key);
       const { redirect_uri, type, uid } = JSON.parse(val);
       const { redirect_uri, type, uid } = JSON.parse(val);
       console.log('redirect_uri-->' + redirect_uri);
       console.log('redirect_uri-->' + redirect_uri);
-      if(type === '0'){
+      if (type === '0') {
         // 通过openid取得用户信息
         // 通过openid取得用户信息
         const user = await this.ctx.service.user.findByOpenid(openid);
         const user = await this.ctx.service.user.findByOpenid(openid);
         if (user) {
         if (user) {
@@ -92,7 +92,7 @@ class WeixinController extends Controller {
           // TODO: 重定性页面
           // TODO: 重定性页面
           this.ctx.redirect(to_uri);
           this.ctx.redirect(to_uri);
         }
         }
-      } elseif(type === '1'){
+      } else if (type === '1') {
         const user = await this.ctx.service.user.fetch(uid);
         const user = await this.ctx.service.user.fetch(uid);
         let _type = '';
         let _type = '';
         if (user) {
         if (user) {
@@ -116,7 +116,7 @@ class WeixinController extends Controller {
     assert(redirect_uri, '回调地址不能为空');
     assert(redirect_uri, '回调地址不能为空');
     assert(openid, 'openid不能为空');
     assert(openid, 'openid不能为空');
 
 
-    if(type === '0'){
+    if (type === '0') {
       // 通过openid取得用户信息
       // 通过openid取得用户信息
       const user = await this.ctx.service.user.findByOpenid(openid);
       const user = await this.ctx.service.user.findByOpenid(openid);
       if (user) {
       if (user) {
@@ -131,7 +131,7 @@ class WeixinController extends Controller {
         // TODO: 重定性页面
         // TODO: 重定性页面
         this.ctx.redirect(to_uri);
         this.ctx.redirect(to_uri);
       }
       }
-    } else if(type === '1'){
+    } else if (type === '1') {
       const user = await this.ctx.service.user.fetch(uid);
       const user = await this.ctx.service.user.fetch(uid);
       let _type = '';
       let _type = '';
       if (user) {
       if (user) {