zs 1 년 전
부모
커밋
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) {
     if (data.team_id) {
       // 检查申请记录
       // 检查申请记录
-      const apply = await this.model.count({
+      let apply = await this.model.count({
         match_id: data.match_id,
         match_id: data.match_id,
         team_id: data.team_id,
         team_id: data.team_id,
+        status: '0',
       });
       });
       if (apply > 0) {
       if (apply > 0) {
         throw new ServiceError(
         throw new ServiceError(
@@ -55,6 +56,18 @@ export class ApplicationService extends BaseService<modelType> {
           FrameworkErrorEnum.BAD_BODY
           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
+        );
+      }
     }
     }
   }
   }