From aab3f279d8f1ae2dc0a0597e8ed614a9c1880f88 Mon Sep 17 00:00:00 2001 From: SHAREit Date: Tue, 1 Sep 2026 15:23:12 +0800 Subject: [PATCH] Publish King campaign report (manual update) --- index.html | 1 + update_report_data.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/index.html b/index.html index a811fb9..e1b2c09 100644 --- a/index.html +++ b/index.html @@ -257,6 +257,7 @@ function renderPerformance(){ if(sands.fetched_at)notes.push(`Sands Cost 抓取于 ${esc(String(sands.fetched_at).replace('T',' '))},不随每日自动更新`); if(sands.scope)notes.push(`Cost 范围:${esc(sands.scope)}`); if(sands.carried_over)notes.push('Cost 沿用上次抓取值,需本地重新抓取才会更新'); + if(sands.stale)notes.push(`Cost 数据滞后:抓取于 ${esc(sands.fetched_date||'')},周期到 ${esc((report.period||{}).end||'')},滞后约 ${num(sands.lag_days)} 天,GP 会偏高`); if(Array.isArray(sands.missing_pkgs)&&sands.missing_pkgs.length) notes.push(`Cost 不完整,缺少包:${esc(sands.missing_pkgs.join(', '))}`); } diff --git a/update_report_data.py b/update_report_data.py index b19ce7d..f9f9123 100644 --- a/update_report_data.py +++ b/update_report_data.py @@ -458,6 +458,19 @@ def build_payload(now): except Exception as error: print(f" Target 读取失败({error});请把该表共享给服务账号或开放链接查看") sands = load_sands_cost() + # 判断 Cost 是否滞后于数据周期 + if sands and sands.get("fetched_at"): + try: + fetched = datetime.fromisoformat(sands["fetched_at"]).date() + except ValueError: + fetched = None + if fetched: + lag = (end_date - fetched).days + 1 + sands["fetched_date"] = fetched.isoformat() + sands["lag_days"] = max(0, lag) + sands["stale"] = lag > 0 + if sands["stale"]: + print(f" 警告:Sands Cost 抓取于 {fetched},可能未覆盖到 {end_date},滞后约 {lag} 天") # 消耗表里可能出现 Cost_Client 未覆盖的 Campaign,一并纳入 for key, _day in wide_costs: