zs 1 год назад
Родитель
Сommit
9e922c3765
1 измененных файлов с 14 добавлено и 1 удалено
  1. 14 1
      src/service/application.service.ts

+ 14 - 1
src/service/application.service.ts

@@ -45,9 +45,10 @@ export class ApplicationService extends BaseService<modelType> {
     }
     if (data.team_id) {
       // 检查申请记录
-      const apply = await this.model.count({
+      let apply = await this.model.count({
         match_id: data.match_id,
         team_id: data.team_id,
+        status: '0',
       });
       if (apply > 0) {
         throw new ServiceError(
@@ -55,6 +56,18 @@ export class ApplicationService extends BaseService<modelType> {
           FrameworkErrorEnum.BAD_BODY
         );
       }
+      // 检查申请记录
+      apply = await this.model.count({
+        match_id: data.match_id,
+        team_id: data.team_id,
+        status: '1',
+      });
+      if (apply > 0) {
+        throw new ServiceError(
+          '申请参加比赛已通过 请勿重复操作!',
+          FrameworkErrorEnum.BAD_BODY
+        );
+      }
     }
   }