lrf402788946 4 éve
szülő
commit
512297da0a

+ 5 - 0
app/controller/users/.organization.js

@@ -125,4 +125,9 @@ module.exports = {
     requestBody: ["id", "openid"],
     service: "bindRemove",
   },
+  // 微信登录
+  wxLogin: {
+    requestBody: ["openid"],
+    service: "wxLogin",
+  },
 };

+ 1 - 0
app/router/users/organization.js

@@ -7,6 +7,7 @@ module.exports = app => {
   const vision = 'v0';
   const index = 'users';
   const target = 'organization';
+  router.post(target, `${profix}${vision}/${index}/${target}/wxLogin`, controller[index][target].wxLogin);
   router.post(target, `${profix}${vision}/${index}/${target}/bindRemove`, controller[index][target].bindRemove);
   router.post(target, `${profix}${vision}/${index}/${target}/bind`, controller[index][target].bind);
   router.get(target, `${profix}${vision}/${index}/${target}/getList`, controller[index][target].getList);

+ 9 - 1
app/service/users/organization.js

@@ -105,8 +105,16 @@ class OrganizationService extends CrudService {
     }
     const res = await this.model.updateMany({ openid }, { openid: undefined });
     return res;
+  }
 
-
+  /**
+   * 企业微信登录
+   * @param {Object} body post body
+   * @property openid
+   */
+  async wxLogin({ openid }) {
+    const org = await this.model.findOne({ openid });
+    return org;
   }
 }