Some checks failed
lotteryadmin CI / build (push) Has been cancelled
- 在赔率行数据结构和接口中新增 provider_code 字段支持多开注商 - 管理后台赔率配置页新增开注商筛选,支持查看和编辑指定开注商赔率 - 未指定专属赔率时,自动继承通用(Global)赔率并显示继承标识 - 新增赔率快照展示组件,显示票据下注时锁定的开注商赔率快照 - 优化赔率保存流程,支持基于开注商区分并批量更新赔率数据 - 更新多语言文案,增加开注商与赔率来源标识翻译 - 调整环境配置文档和默认域名为新的开注商域名地址 - 优化界面标签样式,清晰区分通用、专属和继承赔率来源 - Tickets模块新增赔率快照数据类型及详细展示表格 - 修复管理后台及票据详情页部分链接和操作按钮,提升用户体验
36 lines
994 B
TypeScript
36 lines
994 B
TypeScript
import type { OddsItemRow } from "@/types/api/admin-config";
|
|
|
|
function oddsItemFingerprint(row: OddsItemRow): string {
|
|
return [
|
|
row.provider_code ?? "GLOBAL",
|
|
row.play_code,
|
|
row.prize_scope,
|
|
row.odds_value,
|
|
row.rebate_rate,
|
|
row.commission_rate,
|
|
row.currency_code,
|
|
].join("|");
|
|
}
|
|
|
|
/** 草稿行是否与已保存版本存在差异。 */
|
|
export function oddsDraftIsDirty(draftRows: OddsItemRow[], savedRows: OddsItemRow[]): boolean {
|
|
if (draftRows.length !== savedRows.length) {
|
|
return true;
|
|
}
|
|
|
|
const saved = new Map(savedRows.map((row) => [`${row.provider_code ?? "GLOBAL"}|${row.play_code}|${row.prize_scope}`, row]));
|
|
|
|
for (const draft of draftRows) {
|
|
const key = `${draft.provider_code ?? "GLOBAL"}|${draft.play_code}|${draft.prize_scope}`;
|
|
const baseline = saved.get(key);
|
|
if (!baseline) {
|
|
return true;
|
|
}
|
|
if (oddsItemFingerprint(draft) !== oddsItemFingerprint(baseline)) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|