|
@@ -32,7 +32,7 @@ export class MatchRegistrationController implements BaseController {
|
|
|
@Inject()
|
|
|
smsService: AliyunSmsService;
|
|
|
@Inject()
|
|
|
- matchExtService: MatchExtService
|
|
|
+ matchExtService: MatchExtService;
|
|
|
|
|
|
@Config('PathConfig.path')
|
|
|
path;
|
|
@@ -70,27 +70,28 @@ export class MatchRegistrationController implements BaseController {
|
|
|
@Validate()
|
|
|
async create(@Body() data: object) {
|
|
|
// 检查赛事拓展表中对应的拓展信息状态,如果不是报名中,则不允许添加
|
|
|
- const match_id = get(data, 'match_id')
|
|
|
+ const match_id = get(data, 'match_id');
|
|
|
if (!match_id) {
|
|
|
// 抛出异常: 需要赛事信息
|
|
|
- throw new ServiceError(ErrorCode.MATCH_REG_NEED_MATCH_ID)
|
|
|
+ throw new ServiceError(ErrorCode.MATCH_REG_NEED_MATCH_ID);
|
|
|
}
|
|
|
- const matchInfo = await this.matchService.fetch({ id: match_id })
|
|
|
+ const matchInfo = await this.matchService.fetch({ id: match_id });
|
|
|
if (!matchInfo) {
|
|
|
-
|
|
|
+ // 抛出异常: 没找到赛事
|
|
|
+ throw new ServiceError(ErrorCode.DATA_NOT_FOUND);
|
|
|
}
|
|
|
const match_status = get(matchInfo, 'match_status');
|
|
|
- if (match_status != "1") {
|
|
|
+ if (match_status !== '1') {
|
|
|
// 抛出异常: 该赛事已不处于报名阶段,无法进行报名
|
|
|
throw new ServiceError(ErrorCode.MATCH_NOT_FOUND);
|
|
|
}
|
|
|
- const matchExtInfo = await this.matchExtService.fetch({ match_id })
|
|
|
+ const matchExtInfo = await this.matchExtService.fetch({ match_id });
|
|
|
if (!matchExtInfo) {
|
|
|
// 抛出异常: 未找到赛事拓展信息
|
|
|
- throw new ServiceError(ErrorCode.MATCH_EXT_DATA_NOT_FOUND)
|
|
|
+ throw new ServiceError(ErrorCode.MATCH_EXT_DATA_NOT_FOUND);
|
|
|
}
|
|
|
- const match_ext_status = get(matchExtInfo, 'status')
|
|
|
- if (match_ext_status != '0') {
|
|
|
+ const match_ext_status = get(matchExtInfo, 'status');
|
|
|
+ if (match_ext_status !== '0') {
|
|
|
// 抛出异常: 该赛事已不处于报名阶段,无法进行报名
|
|
|
throw new ServiceError(ErrorCode.MATCH_REG_MATCH_IS_NOT_REG);
|
|
|
}
|
|
@@ -183,11 +184,11 @@ export class MatchRegistrationController implements BaseController {
|
|
|
|
|
|
@Post('/score/:id', { routerName: '为初审选手打分' })
|
|
|
async setScore(@Param('id') id: string, @Body() data: object) {
|
|
|
- const regData = await this.service.fetch({ id })
|
|
|
- if (!regData) throw new ServiceError(ErrorCode.DATA_NOT_FOUND)
|
|
|
- const score = get(data, 'score')
|
|
|
- if (score) await this.service.update({ id }, { score })
|
|
|
- return 'ok'
|
|
|
+ const regData = await this.service.fetch({ id });
|
|
|
+ if (!regData) throw new ServiceError(ErrorCode.DATA_NOT_FOUND);
|
|
|
+ const score = get(data, 'score');
|
|
|
+ if (score) await this.service.update({ id }, { score });
|
|
|
+ return 'ok';
|
|
|
}
|
|
|
|
|
|
@Get('/view/:match_id', { routerName: '查看初审名单结果' })
|