Publish King campaign report (manual update)

This commit is contained in:
SHAREit
2026-09-01 15:23:12 +08:00
parent 9e152bd0bf
commit aab3f279d8
2 changed files with 14 additions and 0 deletions
+13
View File
@@ -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: