feat(config): 重构配置模块导航与版本切换,新增版本删除能力

This commit is contained in:
2026-05-15 15:30:52 +08:00
parent 000295ae2b
commit 8bd7cc3d73
20 changed files with 669 additions and 377 deletions

View File

@@ -0,0 +1,77 @@
/**
* 运营配置子导航与面包屑的单一数据源。
* 新增配置页:在此追加条目,并增加 `app/admin/(shell)/config/.../page.tsx`。
*/
export type ConfigNavGroup = {
id: string;
label: string;
items: readonly {
href: string;
title: string;
description: string;
}[];
};
export const CONFIG_NAV_GROUPS: readonly ConfigNavGroup[] = [
{
id: "betting",
label: "投注与展示",
items: [
{
href: "/admin/config/plays",
title: "玩法与限额",
description: "目录开关、单玩法限额、版本发布",
},
{
href: "/admin/config/odds",
title: "赔率",
description: "按玩法与奖级维护乘数与币种",
},
{
href: "/admin/config/rebate",
title: "佣金 / 回水",
description: "从赔率草稿批量调整回水比例",
},
],
},
{
id: "risk_wallet",
label: "风控与资金",
items: [
{
href: "/admin/config/risk-cap",
title: "赔付封顶",
description: "按号码维度的封顶版本",
},
{
href: "/admin/config/wallet",
title: "钱包阈值",
description: "转入转出上下限(系统设置)",
},
],
},
] as const;
const CONFIG_ROUTE_LABEL_ENTRIES: readonly [string, string][] = [
["plays", "玩法与限额"],
["odds", "赔率"],
["rebate", "佣金 / 回水"],
["risk-cap", "赔付封顶"],
["wallet", "钱包阈值"],
];
/** 面包屑第三段 slug → 中文 */
export const CONFIG_ROUTE_LABELS: Readonly<Record<string, string>> = Object.fromEntries(
CONFIG_ROUTE_LABEL_ENTRIES,
) as Readonly<Record<string, string>>;
export function flattenConfigNavHrefs(): string[] {
const out: string[] = [];
for (const g of CONFIG_NAV_GROUPS) {
for (const it of g.items) {
out.push(it.href);
}
}
return out;
}