lrf 2 anos atrás
pai
commit
113b2c934b
1 arquivos alterados com 6 adições e 4 exclusões
  1. 6 4
      app/service/eliminate.js

+ 6 - 4
app/service/eliminate.js

@@ -343,6 +343,7 @@ class EliminateService extends CrudService {
         data.player_two_name = `${_.get(p2, 'one_member_name')}-${_.get(p2, 'two_member_name')}`;
       }
     }
+
     return data;
   }
   // 获取其他名称
@@ -373,11 +374,12 @@ class EliminateService extends CrudService {
     return data;
   }
   async afterQuery(filter, data) {
-    if (data) data = JSON.parse(JSON.stringify(data));
+    const arr = [];
     for (let d of data) {
       d = await this.getPlayerName(d);
+      arr.push(d);
     }
-    return data;
+    return arr;
   }
 
   // 如果打完比赛,则自动推进
@@ -385,8 +387,8 @@ class EliminateService extends CrudService {
     const { status } = data;
     if (status === '2') await this.toNextRace(data);
     const { _id } = data;
-    data = await this.fetch({ _id });
-    return data;
+    const nd = await this.fetch({ _id });
+    return nd;
   }
   // 自动推进至下一场
   async toNextRace(data) {