Compare commits

..

1 Commits

Author SHA1 Message Date
linkeyu ac4ccf7eea 优化:完善广告收益顶部筛选默认值 2026-07-26 19:49:58 +08:00
3 changed files with 12 additions and 48 deletions
+8 -32
View File
@@ -196,16 +196,7 @@ type AdRevenueDetailRow = AdRevenueRecord & { source_adn?: string | null };
// 展开行(逐条事件展开)- 该条的发奖复算明细(还原金币审计的 eCPM/因子1/份数/LT/因子2 等列)
const DETAIL_COLUMNS: ColumnsType<AdRevenueDetailRow> = [
{
title: '来源广告网络',
dataIndex: 'source_adn',
width: 110,
render: (value: string | null) => value?.trim() || (
<Tooltip title="该历史记录没有可唯一确认的 SDK 广告来源,未猜测填充。">
<span></span>
</Tooltip>
),
},
{ title: '来源广告网络', dataIndex: 'source_adn', width: 110, render: (value: string | null) => value || '-' },
{
title: 'eCPM(元)',
dataIndex: 'ecpm',
@@ -672,17 +663,9 @@ export default function AdRevenueReportPage() {
: data.date_from
: `${data.date_from} ~ ${data.date_to}`;
// 第二行大盘「分广告类型」:看视频包含福利视频与提现视频;
// eCPM 使用合并后的总收益 ÷ 总展示数 × 1000,避免只读取 reward_video 而漏算提现视频。
// 第二行大盘「分广告类型」:draw / 激励视频 各自 收益 / eCPM / 展示条数;eCPM = 收益÷展示×1000。
const drawStat = data?.type_stats?.draw;
const rewardVideoStat = data?.type_stats?.reward_video;
const withdrawalVideoStat = data?.type_stats?.withdrawal_video;
const videoStat: AdRevenueTypeStat = {
impressions:
(rewardVideoStat?.impressions ?? 0) + (withdrawalVideoStat?.impressions ?? 0),
revenue_yuan:
(rewardVideoStat?.revenue_yuan ?? 0) + (withdrawalVideoStat?.revenue_yuan ?? 0),
};
const rvStat = data?.type_stats?.reward_video;
const ecpmOf = (s?: AdRevenueTypeStat) =>
s && s.impressions > 0 ? (s.revenue_yuan / s.impressions) * 1000 : 0;
@@ -1004,13 +987,13 @@ export default function AdRevenueReportPage() {
<Statistic title="Draw 信息流条数" value={drawStat?.impressions ?? 0} />
</Col>
<Col span={4}>
<Statistic title="看视频收益(元)" value={videoStat.revenue_yuan} precision={4} />
<Statistic title="看视频收益(元)" value={rvStat?.revenue_yuan ?? 0} precision={4} />
</Col>
<Col span={4}>
<Statistic title="看视频 eCPM(元/千次)" value={ecpmOf(videoStat)} precision={2} />
<Statistic title="看视频 eCPM(元/千次)" value={ecpmOf(rvStat)} precision={2} />
</Col>
<Col span={4}>
<Statistic title="看视频条数" value={videoStat.impressions} />
<Statistic title="看视频条数" value={rvStat?.impressions ?? 0} />
</Col>
</Row>
<Divider orientation="left" plain style={{ marginTop: 20, marginBottom: 16 }}>
@@ -1119,11 +1102,7 @@ export default function AdRevenueReportPage() {
style={{ marginTop: 8 }}
rowKey="record_id"
columns={DETAIL_COLUMNS}
dataSource={r.sub_rewards.map((detail) => ({
...detail,
// 一次比价/领券可能由不同 ADN 连续填充,优先显示本条发奖记录的来源。
source_adn: detail.adn ?? r.adn,
}))}
dataSource={r.sub_rewards.map((detail) => ({ ...detail, source_adn: r.adn }))}
pagination={false}
size="small"
scroll={{ x: 900 }}
@@ -1139,10 +1118,7 @@ export default function AdRevenueReportPage() {
style={{ marginTop: 8 }}
rowKey="record_id"
columns={DETAIL_COLUMNS}
dataSource={[{
...r.reward_detail,
source_adn: r.reward_detail.adn ?? r.adn,
}]}
dataSource={[{ ...r.reward_detail, source_adn: r.adn }]}
pagination={false}
size="small"
scroll={{ x: 900 }}
+4 -14
View File
@@ -91,7 +91,6 @@ const NAV_GROUPS: NavGroup[] = [
{ key: '/users', icon: <UserOutlined />, label: '用户管理' },
],
},
{ key: '/admins', icon: <TeamOutlined />, label: '权限管理' },
{
key: 'monitoring-audit',
icon: <FileSearchOutlined />,
@@ -104,6 +103,7 @@ const NAV_GROUPS: NavGroup[] = [
{ key: '/audit-logs', icon: <FileSearchOutlined />, label: '审计日志' },
],
},
{ key: '/admins', icon: <TeamOutlined />, label: '权限管理' },
];
// 导航项 key(/dashboard)→ 权限页 key(dashboard),与后端 permissions.py 目录对齐
@@ -223,7 +223,8 @@ export default function MainLayout({ children }: { children: React.ReactNode })
position: 'sticky',
top: 0,
height: '100vh',
overflow: 'hidden',
overflowY: 'auto',
overflowX: 'hidden',
}}
>
<nav className={`side-nav${collapsed ? ' side-nav-collapsed' : ''}`} aria-label="后台导航">
@@ -313,19 +314,8 @@ export default function MainLayout({ children }: { children: React.ReactNode })
.side-nav {
display: flex;
flex-direction: column;
box-sizing: border-box;
gap: 4px;
height: calc(100vh - 48px);
min-height: 0;
overflow-x: hidden;
overflow-y: auto;
overscroll-behavior: contain;
padding: 0 10px 20px;
scrollbar-gutter: stable;
-webkit-overflow-scrolling: touch;
}
.side-nav:focus-within {
scroll-behavior: smooth;
padding: 0 10px 14px;
}
.nav-group {
padding: 6px 0 8px;
-2
View File
@@ -542,8 +542,6 @@ export interface AdRevenueRecord {
expected_coin: number;
actual_coin: number;
matched: boolean;
adn: string | null; // 本条发奖对应的实际填充 ADN
slot_id: string | null; // 本条发奖对应的底层 mediation rit
}
// 广告收益报表:按日期汇总的一天(按天趋势图用;全量,不受分页影响)