feat(admin,api,player): 优胜赛配置、赛事管理重构与玩家端投注体验优化
管理端拆分赛事/优胜赛 Tab,新增联赛优胜赔率面板(批量、排序、外侧删除);统一 list-chrome 工具栏对齐与列表页布局;Dashboard 失败重试、Users 操作下拉、小屏侧栏等体验修复。 API 扩展优胜赛与赛事目录接口,完善投注与钱包查询;玩家端重构赛事卡片、串关面板、注单/钱包页,新增注单详情、下注成功动画与下拉刷新。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -247,6 +247,35 @@ export class BetsService {
|
||||
return { items, total, page, pageSize };
|
||||
}
|
||||
|
||||
async getUserBetStats(userId: bigint) {
|
||||
const [byStatus, aggregates] = await Promise.all([
|
||||
this.prisma.bet.groupBy({
|
||||
by: ['status'],
|
||||
where: { userId },
|
||||
_count: { id: true },
|
||||
_sum: { stake: true, actualReturn: true, potentialReturn: true },
|
||||
}),
|
||||
this.prisma.bet.aggregate({
|
||||
where: { userId },
|
||||
_sum: { stake: true, actualReturn: true, potentialReturn: true },
|
||||
_count: { id: true },
|
||||
}),
|
||||
]);
|
||||
|
||||
return {
|
||||
total: aggregates._count.id,
|
||||
totalStake: aggregates._sum.stake?.toString() ?? '0',
|
||||
totalReturn: aggregates._sum.actualReturn?.toString() ?? '0',
|
||||
totalPotentialReturn: aggregates._sum.potentialReturn?.toString() ?? '0',
|
||||
byStatus: byStatus.map((g) => ({
|
||||
status: g.status,
|
||||
count: g._count.id,
|
||||
totalStake: g._sum.stake?.toString() ?? '0',
|
||||
totalReturn: g._sum.actualReturn?.toString() ?? '0',
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
async getBetByNo(betNo: string, userId?: bigint) {
|
||||
return this.prisma.bet.findFirst({
|
||||
where: { betNo, ...(userId ? { userId } : {}) },
|
||||
|
||||
Reference in New Issue
Block a user