Files
thebet365/apps/admin/src/utils/selectionDefaults.ts
Mars cc737e2924 feat(admin,api,player): 赛事分组管理、盘口独立页与多语言展示优化
- 管理端按联赛展示单场,新增赛事/单场流程与列表展开状态保持

- 盘口赔率迁至独立页面,保存按钮仅在有修改时高亮

- API 新增联赛列表与子场查询,按 locale 返回队名并修复编译

- 波胆其它选项与促销标签等 i18n 补齐,文案更易懂
2026-06-04 16:25:03 +08:00

43 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** 标准盘口选项的固定显示名(写入 DB玩家端也会按 code 做 i18n */
function handicapName(side: 'home' | 'away', line: number, half: boolean) {
const sideLabel = side === 'home' ? '主队' : '客队';
const value = side === 'home' ? line : -line;
const lineText = value > 0 ? `+${value}` : `${value}`;
return half ? `半场${sideLabel} ${lineText}` : `${sideLabel} ${lineText}`;
}
function ouName(side: 'over' | 'under', line: number, half: boolean) {
const sideLabel = side === 'over' ? '大' : '小';
return half ? `半场${sideLabel} ${line}` : `${sideLabel} ${line}`;
}
export function defaultSelectionName(
code: string,
opts: { lineValue?: number | null; period?: string },
): string {
const half = opts.period === 'HT';
const line = opts.lineValue;
if (code === 'HOME' && line != null) return handicapName('home', line, half);
if (code === 'AWAY' && line != null) return handicapName('away', line, half);
if (code === 'OVER' && line != null) return ouName('over', line, half);
if (code === 'UNDER' && line != null) return ouName('under', line, half);
const fixed: Record<string, string> = {
HOME: '主胜',
DRAW: '和',
AWAY: '客胜',
ODD: '单',
EVEN: '双',
OTHER_DRAW: '和局其它比分',
OTHER_HOME: '主胜其它比分',
OTHER_AWAY: '客胜其它比分',
};
if (fixed[code]) return fixed[code];
if (code.startsWith('SCORE_')) {
return code.replace('SCORE_', '').replace('_', '-');
}
return code;
}