feat(admin,api,player): 结算预览分页、统计图表与返水限额

完善结算计算与预览 API(含后端分页),加强管理端结算/返水/权限,并优化玩家端投注单与队徽展示。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-05 13:54:33 +08:00
parent 6264b8806c
commit efff7c27e6
40 changed files with 3560 additions and 578 deletions

View File

@@ -110,9 +110,40 @@ describe('SettlementCalculator', () => {
});
expect(r).toBe('HALF_LOSE');
});
it('0-0: home -0.5 loses', () => {
const s = { htHome: 0, htAway: 0, ftHome: 0, ftAway: 0 };
expect(
settleSelection({
marketType: 'FT_HANDICAP',
selectionCode: 'HOME',
handicapLine: -0.5,
score: s,
}),
).toBe('LOSE');
});
});
describe('Over/Under', () => {
it('0-0: under 2.5 wins, over 2.5 loses', () => {
const s = { htHome: 0, htAway: 0, ftHome: 0, ftAway: 0 };
const under = settleSelection({
marketType: 'FT_OVER_UNDER',
selectionCode: 'UNDER',
totalLine: 2.5,
score: s,
});
const over = settleSelection({
marketType: 'FT_OVER_UNDER',
selectionCode: 'OVER',
totalLine: 2.5,
score: s,
});
expect(under).toBe('WIN');
expect(over).toBe('LOSE');
expect(calculatePayout(100, 1.95, under).toNumber()).toBe(195);
});
it('S013: over 2.5 wins with 3 goals', () => {
const s = { htHome: 1, htAway: 1, ftHome: 2, ftAway: 1 };
expect(
@@ -177,6 +208,27 @@ describe('SettlementCalculator', () => {
});
});
describe('OUTRIGHT_WINNER', () => {
it('wins when selection matches winner team code', () => {
expect(
settleSelection({
marketType: 'OUTRIGHT_WINNER',
selectionCode: 'BRA',
score: { htHome: 0, htAway: 0, ftHome: 0, ftAway: 0 },
winnerTeamCode: 'BRA',
}),
).toBe('WIN');
expect(
settleSelection({
marketType: 'OUTRIGHT_WINNER',
selectionCode: 'ARG',
score: { htHome: 0, htAway: 0, ftHome: 0, ftAway: 0 },
winnerTeamCode: 'BRA',
}),
).toBe('LOSE');
});
});
describe('Quarter line detection', () => {
it('detects quarter lines', () => {
expect(isQuarterHandicapOrTotal(-0.25)).toBe(true);