Publish King campaign report (manual update)
This commit is contained in:
@@ -364,6 +364,18 @@ def load_sands_cost():
|
||||
]
|
||||
path = next((item for item in candidates if item.exists()), None)
|
||||
if path is None:
|
||||
# 服务器上没有 sands_cost.json(Sands 需登录),沿用上一版 data.json 里的值
|
||||
previous = here.parent / "data.json"
|
||||
if previous.exists():
|
||||
try:
|
||||
sands = (json.loads(previous.read_text(encoding="utf-8")).get("performance") or {}).get("sands")
|
||||
except Exception:
|
||||
sands = None
|
||||
if sands and sands.get("cost"):
|
||||
sands = dict(sands)
|
||||
sands["carried_over"] = True
|
||||
print(f" Sands Cost:沿用上一版 {sands['cost']}(抓取于 {sands.get('fetched_at') or '未知'})")
|
||||
return sands
|
||||
print(" Sands Cost:未找到 sands_cost.json,将留空")
|
||||
return None
|
||||
data = json.loads(path.read_text(encoding="utf-8"))
|
||||
|
||||
Reference in New Issue
Block a user