1
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -28,7 +28,7 @@
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<script type="module" crossorigin src="/assets/index-CkQa2uab.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-W5ctKG_t.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-D7ShJUt4.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -84,7 +84,32 @@ const AdminDashboard: React.FC = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 核心数据 */}
|
||||
<div style={{ marginBottom: 20 }}>
|
||||
<div style={{ marginBottom: 12 }}>
|
||||
<Typography.Text strong style={{ fontSize: 15 }}>核心数据</Typography.Text>
|
||||
</div>
|
||||
<Row gutter={[12, 12]}>
|
||||
{[
|
||||
{ title: '用户数量', value: stats?.totalUsers, icon: <UserOutlined />, color: '#6366f1' },
|
||||
{ title: '总项目数', value: stats?.totalProjects, icon: <ProjectOutlined />, color: '#3b82f6' },
|
||||
{ title: '项目记录', value: stats?.totalRecords, icon: <FileTextOutlined />, color: '#10b981' },
|
||||
{ title: '创作记录', value: stats?.totalGenerations, icon: <PlayCircleOutlined />, color: '#f59e0b' },
|
||||
{ title: '总收入', value: stats?.totalRevenue, icon: <WalletOutlined />, color: '#ec4899', prefix: '¥' },
|
||||
{ title: '消耗积分', value: stats?.creditsConsumedToday, icon: <DollarOutlined />, color: '#ef4444' },
|
||||
].map(s => (
|
||||
<Col xs={12} sm={8} md={4} key={s.title}>
|
||||
<CompactStatCard {...s} loading={loading} />
|
||||
</Col>
|
||||
))}
|
||||
</Row>
|
||||
</div>
|
||||
|
||||
{/* 图表区域 */}
|
||||
<div style={{ marginBottom: 20 }}>
|
||||
<div style={{ marginBottom: 12 }}>
|
||||
<Typography.Text strong style={{ fontSize: 15 }}>数据统计</Typography.Text>
|
||||
</div>
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col xs={24} lg={12}>
|
||||
<ChartCard title="每日积分消耗趋势" loading={loading}>
|
||||
@@ -107,26 +132,6 @@ const AdminDashboard: React.FC = () => {
|
||||
</ChartCard>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
{/* 核心数据 */}
|
||||
<div style={{ marginTop: 24 }}>
|
||||
<div style={{ marginBottom: 12 }}>
|
||||
<Typography.Text strong style={{ fontSize: 15 }}>核心数据</Typography.Text>
|
||||
</div>
|
||||
<Row gutter={[12, 12]}>
|
||||
{[
|
||||
{ title: '用户数量', value: stats?.totalUsers, icon: <UserOutlined />, color: '#6366f1' },
|
||||
{ title: '总项目数', value: stats?.totalProjects, icon: <ProjectOutlined />, color: '#3b82f6' },
|
||||
{ title: '项目记录', value: stats?.totalRecords, icon: <FileTextOutlined />, color: '#10b981' },
|
||||
{ title: '创作记录', value: stats?.totalGenerations, icon: <PlayCircleOutlined />, color: '#f59e0b' },
|
||||
{ title: '总收入', value: stats?.totalRevenue, icon: <WalletOutlined />, color: '#ec4899', prefix: '¥' },
|
||||
{ title: '消耗积分', value: stats?.creditsConsumedToday, icon: <DollarOutlined />, color: '#ef4444' },
|
||||
].map(s => (
|
||||
<Col xs={12} sm={8} md={4} key={s.title}>
|
||||
<CompactStatCard {...s} loading={loading} />
|
||||
</Col>
|
||||
))}
|
||||
</Row>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1856,8 +1856,8 @@ async def get_stats(
|
||||
)
|
||||
)).scalar() or 0
|
||||
|
||||
# ── 每日各模块积分消耗(按日期+模块分组)
|
||||
daily_credits_rows = (await db.execute(
|
||||
# ── 每日各模块积分消耗(按日期+模块分组,子查询排序避免 PG GROUP BY 限制)
|
||||
_daily_subq = (
|
||||
select(
|
||||
func.to_char(CreditRecord.created_at, 'YYYY-MM-DD').label('date'),
|
||||
func.coalesce(CreditRecord.source_module, 'other').label('module'),
|
||||
@@ -1869,7 +1869,11 @@ async def get_stats(
|
||||
CreditRecord.created_at <= date_end,
|
||||
)
|
||||
.group_by(func.to_char(CreditRecord.created_at, 'YYYY-MM-DD'), func.coalesce(CreditRecord.source_module, 'other'))
|
||||
.order_by(func.to_char(CreditRecord.created_at, 'YYYY-MM-DD'))
|
||||
.subquery()
|
||||
)
|
||||
daily_credits_rows = (await db.execute(
|
||||
select(_daily_subq.c.date, _daily_subq.c.module, _daily_subq.c.credits)
|
||||
.order_by(_daily_subq.c.date)
|
||||
)).all()
|
||||
daily_credits_by_module = [
|
||||
DailyCreditOut(date=row.date, module=row.module, credits=float(row.credits or 0))
|
||||
|
||||
Reference in New Issue
Block a user