Files
lotteryAdmin/src/modules/config/doc/odds-config-dirty.ts
kang af982bb9f7 feat(api, agents, i18n): enhance settlement features and multi-language support
Added new types and API functions for settlement period summaries and credit ledgers, improving the management of agent settlements. Updated the admin console to reflect these changes, enhancing user experience with better navigation and data presentation. Additionally, expanded multi-language support by incorporating new translations in English, Nepali, and Chinese for settlement-related terms, ensuring consistency across the platform.
2026-06-05 18:00:59 +08:00

35 lines
891 B
TypeScript

import type { OddsItemRow } from "@/types/api/admin-config";
function oddsItemFingerprint(row: OddsItemRow): string {
return [
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.play_code}|${row.prize_scope}`, row]));
for (const draft of draftRows) {
const key = `${draft.play_code}|${draft.prize_scope}`;
const baseline = saved.get(key);
if (!baseline) {
return true;
}
if (oddsItemFingerprint(draft) !== oddsItemFingerprint(baseline)) {
return true;
}
}
return false;
}