zs il y a 1 an
Parent
commit
24dc23012d
2 fichiers modifiés avec 13 ajouts et 3 suppressions
  1. 2 2
      src/controller/user.controller.ts
  2. 11 1
      src/service/user.service.ts

+ 2 - 2
src/controller/user.controller.ts

@@ -131,8 +131,8 @@ export class UserController extends BaseController {
   }
   }
 
 
   @Get('/person')
   @Get('/person')
-  async person() {
-    const list = await this.service.person();
+  async person(filter: any) {
+    const list = await this.service.person(filter);
     return list;
     return list;
   }
   }
   async createMany(...args: any[]) {
   async createMany(...args: any[]) {

+ 11 - 1
src/service/user.service.ts

@@ -44,13 +44,23 @@ export class UserService extends BaseService<modelType> {
     return user;
     return user;
   }
   }
   // 团队人员
   // 团队人员
-  async person() {
+  async person(filter) {
+    const { team } = filter;
     const list = await this.model.find({ status: '1', type: '0' });
     const list = await this.model.find({ status: '1', type: '0' });
     const result = [];
     const result = [];
     for (const val of list) {
     for (const val of list) {
       const total = await this.TeamModel.count({ member: { $in: [val.id] } });
       const total = await this.TeamModel.count({ member: { $in: [val.id] } });
       if (total === 0) result.push(val);
       if (total === 0) result.push(val);
     }
     }
+    if (team) {
+      const teamInfo: any = await this.TeamModel.findById(team);
+      if (teamInfo.member) {
+        for (const val of teamInfo.member) {
+          const list = await this.model.findById(val);
+          if (list) result.push(list);
+        }
+      }
+    }
     return result;
     return result;
   }
   }
 }
 }