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.
35 lines
891 B
TypeScript
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;
|
|
}
|