zs 3 mesiacov pred
rodič
commit
8ce43463da
1 zmenil súbory, kde vykonal 17 pridanie a 5 odobranie
  1. 17 5
      src/controller/match/matchExt.controller.ts

+ 17 - 5
src/controller/match/matchExt.controller.ts

@@ -483,9 +483,21 @@ export class MatchExtController implements BaseController {
      */
     // await this.service.checkMatchExtStatus(match_id, '5');
     // 决赛名单,根据顺序升序
-    const final_confirm = get(query, 'final_confirm')
-    const { data: list } = await this.matchRegService.query({ match_id, ext_status: '5', final_confirm }, { order: { final_order_no: 'ASC' } });
-    return list;
+    const final_confirm = get(query, 'final_confirm');
+    const ext_status = get(query, 'ext_status');
+    const { data: list } = await this.matchRegService.query({ match_id, ext_status, final_confirm }, { order: { final_order_no: 'ASC' } });
+    const fillList = [];
+    for (const i of list) {
+      const newItem = cloneDeep(i);
+      const user_id = get(i, 'user_id');
+      const user = await this.userService.fetch({ id: user_id });
+      if (user) newItem.user_name = get(user, 'nick_name');
+      const match_id = get(i, 'match_id');
+      const match = await this.matchService.fetch({ id: match_id });
+      if (match) newItem.match_name = get(match, 'name');
+      fillList.push(newItem);
+    }
+    return fillList;
   }
 
   /**
@@ -659,11 +671,11 @@ export class MatchExtController implements BaseController {
   /**
    * 人为规定的决赛实时名单
    * @param match_id 赛事id
-   * @returns 
+   * @returns
    */
   @Post('/lastList/:match_id', { routerName: '赛事决赛名单' })
   async lastList(@Param('match_id') match_id: string) {
-    const list = await this.matchRegService.getArrangeList(match_id)
+    const list = await this.matchRegService.getArrangeList(match_id);
     return list;
   }
 }