|
@@ -64,12 +64,16 @@ export class MatchRegistrationController implements BaseController {
|
|
|
const dbData = await this.userService.create(user);
|
|
|
regData = { user_id: dbData.id, ...regData }
|
|
|
}
|
|
|
-
|
|
|
- const query = { match_id: get(data, 'match_id') }
|
|
|
+
|
|
|
+ const query = { match_id: get(data, 'match_id'), user_id: get(regData, 'user_id') }
|
|
|
const { total } = await this.service.query(query)
|
|
|
if (total > 0) throw new ServiceError(ErrorCode.MATCH_USER_HAS_REGISTED)
|
|
|
+
|
|
|
+ const { total: matchRegTotal = 0 } = await this.service.query({ match_id: get(data, 'match_id') })
|
|
|
+ const no = `${get(data, 'match_id')}-${get(regData, 'user_id')}-${matchRegTotal + 1}`
|
|
|
+ regData = { ...regData, no }
|
|
|
const result = await this.service.create(regData);
|
|
|
- return false;
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
@Post('/:id', { routerName: `修改${namePrefix}` })
|