zs преди 1 година
родител
ревизия
f37706f598
променени са 2 файла, в които са добавени 37 реда и са изтрити 37 реда
  1. 12 12
      src/controller/application.controller.ts
  2. 25 25
      src/service/application.service.ts

+ 12 - 12
src/controller/application.controller.ts

@@ -19,7 +19,7 @@ import {
   UDTO_application,
   UVAO_application,
 } from '../interface/application.interface';
-import { QVO_team } from '../interface/team.interface';
+// import { QVO_team } from '../interface/team.interface';
 import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
 import { Validate } from '@midwayjs/validate';
 @ApiTags(['比赛报名'])
@@ -52,17 +52,17 @@ export class ApplicationController extends BaseController {
     return { data, total };
   }
 
-  @Get('/team')
-  async team(@Query() filter: any) {
-    const list = await this.service.teamQuery(filter);
-    const data = [];
-    for (const i of list.list) {
-      const newData = new QVO_team(i);
-      data.push(newData);
-    }
-    const total = list.total;
-    return { data, total };
-  }
+  // @Get('/team')
+  // async team(@Query() filter: any) {
+  //   const list = await this.service.teamQuery(filter);
+  //   const data = [];
+  //   for (const i of list.list) {
+  //     const newData = new QVO_team(i);
+  //     data.push(newData);
+  //   }
+  //   const total = list.total;
+  //   return { data, total };
+  // }
 
   @Get('/:id')
   @ApiResponse({ type: FVO_application })

+ 25 - 25
src/service/application.service.ts

@@ -12,8 +12,8 @@ import { Match } from '../entity/match.entity';
 import { User } from '../entity/user.entity';
 import { Team } from '../entity/team.entity';
 const moment = require('moment');
-import isEqual = require('lodash/isEqual');
-import uniqWith = require('lodash/uniqWith');
+// import isEqual = require('lodash/isEqual');
+// import uniqWith = require('lodash/uniqWith');
 type modelType = ReturnModelType<typeof Application>;
 @Provide()
 export class ApplicationService extends BaseService<modelType> {
@@ -96,27 +96,27 @@ export class ApplicationService extends BaseService<modelType> {
       return { list, total };
     }
   }
-  // 查询参赛团队
-  async teamQuery(filter) {
-    const { skip = 0, limit = 0, ...info } = filter;
-    const data: any = await this.model.find(info);
-    let team = data.map(i => {
-      return i.team_id;
-    });
-    team = uniqWith(team, isEqual);
-    const res = [];
-    for (const val of team) {
-      const data = await this.TeamModel.findById(val);
-      if (data) res.push(data);
-    }
-    const list = this.pagination(skip, limit, res);
-    const total = list.length;
-    return { list, total };
-  }
-  pagination(pageNo, pageSize, array) {
-    const offset = pageNo * pageSize;
-    return offset + pageSize >= array.length
-      ? array.slice(offset, array.length)
-      : array.slice(offset, offset + pageSize);
-  }
+  // // 查询参赛团队
+  // async teamQuery(filter) {
+  //   const { skip = 0, limit = 0, ...info } = filter;
+  //   const data: any = await this.model.find(info);
+  //   let team = data.map(i => {
+  //     return i.team_id;
+  //   });
+  //   team = uniqWith(team, isEqual);
+  //   const res = [];
+  //   for (const val of team) {
+  //     const data = await this.TeamModel.findById(val);
+  //     if (data) res.push(data);
+  //   }
+  //   const list = this.pagination(skip, limit, res);
+  //   const total = list.length;
+  //   return { list, total };
+  // }
+  // pagination(pageNo, pageSize, array) {
+  //   const offset = pageNo * pageSize;
+  //   return offset + pageSize >= array.length
+  //     ? array.slice(offset, array.length)
+  //     : array.slice(offset, offset + pageSize);
+  // }
 }