|
@@ -14,6 +14,7 @@ import { ServiceUtilService } from '../../service/serviceUtil.service';
|
|
|
import * as Excel from 'exceljs';
|
|
|
import { UtilService } from '../../service/util.service';
|
|
|
import { AliyunSmsService } from '../../service/thirdParty/aliyunSms.service';
|
|
|
+import { MatchExtService } from '../../service/match/matchExt.service';
|
|
|
const namePrefix = '创新大赛-赛事报名';
|
|
|
@ApiTags(['创新大赛-赛事报名'])
|
|
|
@Controller('/matchReg', { tagName: namePrefix })
|
|
@@ -30,6 +31,8 @@ export class MatchRegistrationController implements BaseController {
|
|
|
utilService: UtilService;
|
|
|
@Inject()
|
|
|
smsService: AliyunSmsService;
|
|
|
+ @Inject()
|
|
|
+ matchExtService: MatchExtService
|
|
|
|
|
|
@Config('PathConfig.path')
|
|
|
path;
|
|
@@ -74,14 +77,24 @@ export class MatchRegistrationController implements BaseController {
|
|
|
}
|
|
|
const matchInfo = await this.matchService.fetch({ id: match_id })
|
|
|
if (!matchInfo) {
|
|
|
+
|
|
|
+ }
|
|
|
+ const match_status = get(matchInfo, 'match_status');
|
|
|
+ if (match_status != "1") {
|
|
|
+ // 抛出异常: 该赛事已不处于报名阶段,无法进行报名
|
|
|
+ throw new ServiceError(ErrorCode.MATCH_NOT_FOUND);
|
|
|
+ }
|
|
|
+ const matchExtInfo = await this.matchExtService.fetch({ match_id })
|
|
|
+ if (!matchExtInfo) {
|
|
|
// 抛出异常: 未找到赛事拓展信息
|
|
|
throw new ServiceError(ErrorCode.MATCH_EXT_DATA_NOT_FOUND)
|
|
|
}
|
|
|
- const match_status = get(matchInfo, 'status');
|
|
|
- if (match_status != "0") {
|
|
|
+ const match_ext_status = get(matchExtInfo, 'status')
|
|
|
+ if (match_ext_status != '0') {
|
|
|
// 抛出异常: 该赛事已不处于报名阶段,无法进行报名
|
|
|
throw new ServiceError(ErrorCode.MATCH_REG_MATCH_IS_NOT_REG);
|
|
|
}
|
|
|
+
|
|
|
const userColumns = ['user', 'user_id'];
|
|
|
let regData = omit(data, userColumns);
|
|
|
let returnUser = {};
|