fix(settlement): 要求封盘后才能结算并优化预览流程

封盘前禁止录入比分与生成预览;待结算未确认前可解除封盘。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-11 17:49:34 +08:00
parent 03e72ca9b2
commit e469611138
9 changed files with 210 additions and 54 deletions

View File

@@ -1925,24 +1925,12 @@ export class AdminController {
@Body() dto?: SettlementPreviewDto,
) {
const matchId = BigInt(id);
const hasScore =
dto?.htHome !== undefined ||
dto?.htAway !== undefined ||
dto?.ftHome !== undefined ||
dto?.ftAway !== undefined ||
dto?.winnerTeamId !== undefined;
if (hasScore) {
await this.settlement.recordScore(
matchId,
dto!.htHome ?? 0,
dto!.htAway ?? 0,
dto!.ftHome ?? 0,
dto!.ftAway ?? 0,
operatorId,
dto!.winnerTeamId != null ? BigInt(dto!.winnerTeamId) : undefined,
);
}
const preview = await this.settlement.previewSettlement(matchId, operatorId, {
htHome: dto?.htHome,
htAway: dto?.htAway,
ftHome: dto?.ftHome,
ftAway: dto?.ftAway,
winnerTeamId: dto?.winnerTeamId != null ? BigInt(dto.winnerTeamId) : undefined,
page: dto?.page ? Math.max(1, dto.page) : 1,
pageSize: dto?.pageSize ? Math.min(100, Math.max(1, dto.pageSize)) : 10,
});