lrf402788946 4 年之前
父节点
当前提交
a20f0a1504
共有 2 个文件被更改,包括 7 次插入4 次删除
  1. 3 2
      app/controller/users/.organization.js
  2. 4 2
      app/service/users/organization.js

+ 3 - 2
app/controller/users/.organization.js

@@ -104,6 +104,7 @@ module.exports = {
     parameters: {
       query: {
         phone: "phone",
+        name: "name",
       },
       options: {
         query: ["skip", "limit"],
@@ -115,12 +116,12 @@ module.exports = {
     service: "getList",
   },
   // 绑定微信
-  bind:{
+  bind: {
     requestBody: ["id", "openid"],
     service: "bind",
   },
   // 解除绑定
-  bindRemove:{
+  bindRemove: {
     requestBody: ["id", "openid"],
     service: "bindRemove",
   },

+ 4 - 2
app/service/users/organization.js

@@ -3,6 +3,7 @@ const { CrudService } = require('naf-framework-mongoose/lib/service');
 const { BusinessError, ErrorCode } = require('naf-core').Error;
 const _ = require('lodash');
 const jwt = require('jsonwebtoken');
+const assert = require('assert');
 // 机构
 class OrganizationService extends CrudService {
   constructor(ctx) {
@@ -66,8 +67,9 @@ class OrganizationService extends CrudService {
    * @param {Object} query phone:电话号
    * @param {Object} options skip;limit
    */
-  async getList({ phone }, { skip = 0, limit = 0 } = {}) {
-    const list = await this.model.find({ phone }).skip(parseInt(skip)).limit(parseInt(limit));
+  async getList({ name, phone }, { skip = 0, limit = 0 } = {}) {
+    assert(phone, '缺少手机号');
+    const list = await this.model.find({ phone, name }).skip(parseInt(skip)).limit(parseInt(limit));
     return list;
   }