feat(admin,api,player): 结算预览分页、统计图表与返水限额

完善结算计算与预览 API(含后端分页),加强管理端结算/返水/权限,并优化玩家端投注单与队徽展示。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-05 13:54:33 +08:00
parent 6264b8806c
commit efff7c27e6
40 changed files with 3560 additions and 578 deletions

View File

@@ -507,17 +507,20 @@ async function main() {
});
const permCodes = [
'users.create', 'users.view', 'agents.create', 'agents.view',
'users.create', 'users.view', 'agents.create', 'agents.view', 'agents.credit',
'wallet.deposit', 'wallet.withdraw', 'matches.manage', 'settlement.confirm',
'cashback.confirm', 'content.manage', 'reports.view',
'settlement.resettle', 'cashback.confirm', 'content.manage', 'reports.view',
'bets.view', 'settings.manage', 'audit.view',
];
const permIds = new Map<string, bigint>();
for (const code of permCodes) {
const perm = await prisma.permission.upsert({
where: { code },
create: { code, name: code, module: code.split('.')[0] },
update: {},
});
permIds.set(code, perm.id);
await prisma.rolePermission.upsert({
where: { roleId_permissionId: { roleId: superAdminRole.id, permissionId: perm.id } },
create: { roleId: superAdminRole.id, permissionId: perm.id },
@@ -525,6 +528,49 @@ async function main() {
});
}
async function ensureRole(code: string, name: string, permissions: string[]) {
const role = await prisma.role.upsert({
where: { code },
create: { code, name, description: name },
update: { name },
});
for (const p of permissions) {
const pid = permIds.get(p);
if (!pid) continue;
await prisma.rolePermission.upsert({
where: { roleId_permissionId: { roleId: role.id, permissionId: pid } },
create: { roleId: role.id, permissionId: pid },
update: {},
});
}
return role;
}
await ensureRole('MATCH_ADMIN', 'Match Admin', [
'matches.manage', 'settlement.confirm', 'bets.view', 'reports.view', 'audit.view',
]);
await ensureRole('FINANCE_ADMIN', 'Finance Admin', [
'wallet.deposit', 'wallet.withdraw', 'cashback.confirm', 'agents.view',
'reports.view', 'bets.view', 'audit.view',
]);
await ensureRole('SUPPORT', 'Support', ['users.view', 'bets.view', 'reports.view', 'audit.view']);
const defaultBettingLimits = [
['bet.min_stake', '1', '最小单注金额'],
['bet.max_stake_single', '50000', '单关最大投注额'],
['bet.max_stake_parlay', '20000', '串关最大投注额'],
['bet.max_payout_single', '500000', '单关最高派彩'],
['bet.max_payout_parlay', '1000000', '串关最高派彩'],
['bet.daily_stake_limit', '200000', '玩家每日投注上限'],
] as const;
for (const [key, value, desc] of defaultBettingLimits) {
await prisma.systemConfig.upsert({
where: { configKey: key },
create: { configKey: key, configValue: value, description: desc },
update: {},
});
}
const hash = await bcrypt.hash('Admin@123', 10);
const agentHash = await bcrypt.hash('Agent@123', 10);
const playerHash = await bcrypt.hash('Player@123', 10);