فهرست منبع

Merge branch 'main' of http://git.cc-lotus.info/Information/cxyy-service

lrf 5 ماه پیش
والد
کامیت
d40e9d8144
2فایلهای تغییر یافته به همراه30 افزوده شده و 15 حذف شده
  1. 14 7
      src/controller/match/matchExt.controller.ts
  2. 16 8
      src/service/match/matchRegistration.service.ts

+ 14 - 7
src/controller/match/matchExt.controller.ts

@@ -483,15 +483,22 @@ 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' } });
-    const newList = []
+    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) {
-      let newItem = cloneDeep(i)
+      let 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');
       newItem = this.matchRegService.dealData(newItem);
-      newList.push(newItem)
+      fillList.push(newItem);
     }
-    return newList;
+    return fillList;
   }
 
   /**
@@ -665,7 +672,7 @@ export class MatchExtController implements BaseController {
   /**
    * 人为规定的决赛实时名单
    * @param match_id 赛事id
-   * @returns 
+   * @returns
    */
   @Post('/lastList/:match_id', { routerName: '赛事决赛名单' })
   async lastList(@Param('match_id') match_id: string) {

+ 16 - 8
src/service/match/matchRegistration.service.ts

@@ -14,20 +14,28 @@ export class MatchRegistrationService extends BaseServiceV2 {
    * @param match_id 赛事id
    */
   async getArrangeList(match_id) {
-    const { data: list, total } = await this.query({ match_id, order: { final_score: "DESC" } });
+    const { data: list } = await this.query({ match_id, ext_status: '8' }, { order: { final_score: 'DESC' } });
     /**有指定最终排名的数据 */
-    const orderList = orderBy(list.filter(f => f.last_order_no), ['last_order_no'], ['asc'])
+    const orderList = orderBy(
+      list.filter(f => f.last_order_no),
+      ['last_order_no'],
+      ['asc']
+    );
     /**没有指定最终排名的数据 */
-    const freeOrderList = orderBy(list.filter(f => !f.last_order_no), ['final_score'], ['desc'])
+    const freeOrderList = orderBy(
+      list.filter(f => !f.last_order_no),
+      ['final_score'],
+      ['desc']
+    );
     for (const i of orderList) {
-      const no = get(i, 'last_order_no')
-      if (!no || no <= 0) continue
-      const index = no - 1
-      freeOrderList.splice(index, 0, i)
+      const no = get(i, 'last_order_no');
+      if (!no || no <= 0) continue;
+      const index = no - 1;
+      freeOrderList.splice(index, 0, i);
     }
     for (let i = 0; i < freeOrderList.length; i++) {
       const item = freeOrderList[i];
-      item.show_order = i + 1
+      item.show_order = i + 1;
     }
     return freeOrderList;
   }