From 4f43450afaf59ac0c27125763ff9410c70c49dbd Mon Sep 17 00:00:00 2001
From: linkeyu <798648091@qq.com>
Date: Sun, 26 Jul 2026 19:58:13 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=8C=89=E5=8A=A0?=
=?UTF-8?q?=E6=9D=83=E5=8F=A3=E5=BE=84=E5=B1=95=E7=A4=BA=E5=88=86=E7=B1=BB?=
=?UTF-8?q?=20eCPM?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/app/(main)/ad-revenue-report/page.tsx | 14 ++++++++++----
src/lib/types.ts | 2 ++
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/app/(main)/ad-revenue-report/page.tsx b/src/app/(main)/ad-revenue-report/page.tsx
index 189f373..86a992c 100644
--- a/src/app/(main)/ad-revenue-report/page.tsx
+++ b/src/app/(main)/ad-revenue-report/page.tsx
@@ -661,11 +661,17 @@ export default function AdRevenueReportPage() {
: data.date_from
: `${data.date_from} ~ ${data.date_to}`;
- // 第二行大盘「分广告类型」:draw / 激励视频 各自 收益 / eCPM / 展示条数;eCPM = 收益÷展示×1000。
+ // eCPM 优先使用后端按真实展示加权的经营分类口径;兼容旧后端时才用收益÷展示数回退。
const drawStat = data?.type_stats?.draw;
const rvStat = data?.type_stats?.reward_video;
+ const withdrawalVideoStat = data?.type_stats?.withdrawal_video;
+ const drawEcpmStat = data?.category_stats?.draw ?? drawStat;
+ const videoEcpmStat = data?.category_stats?.video ?? {
+ impressions: (rvStat?.impressions ?? 0) + (withdrawalVideoStat?.impressions ?? 0),
+ revenue_yuan: (rvStat?.revenue_yuan ?? 0) + (withdrawalVideoStat?.revenue_yuan ?? 0),
+ };
const ecpmOf = (s?: AdRevenueTypeStat) =>
- s && s.impressions > 0 ? (s.revenue_yuan / s.impressions) * 1000 : 0;
+ s?.ecpm_yuan ?? (s && s.impressions > 0 ? (s.revenue_yuan / s.impressions) * 1000 : 0);
// 明细直接用后端返回的当前页 items(「场景」已由后端 feed_scene 全局过滤,前端不再二次筛)。
const items = data?.items ?? [];
@@ -981,7 +987,7 @@ export default function AdRevenueReportPage() {