From 51603ba251a9809d66dbe025567cf594b7c5206c Mon Sep 17 00:00:00 2001 From: SHAREit Date: Thu, 27 Aug 2026 15:43:25 +0800 Subject: [PATCH] Publish King campaign report (manual update) --- index.html | 1 + schedule.conf | 1 - update.sh | 13 ------------- update_report_data.py | 12 ++++++++++++ 4 files changed, 13 insertions(+), 14 deletions(-) delete mode 100644 schedule.conf delete mode 100644 update.sh diff --git a/index.html b/index.html index bb07b15..f3d9530 100644 --- a/index.html +++ b/index.html @@ -249,6 +249,7 @@ function renderPerformance(){ else{ 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(Array.isArray(sands.missing_pkgs)&&sands.missing_pkgs.length) notes.push(`Cost 不完整,缺少包:${esc(sands.missing_pkgs.join(', '))}`); } diff --git a/schedule.conf b/schedule.conf deleted file mode 100644 index 1d5e644..0000000 --- a/schedule.conf +++ /dev/null @@ -1 +0,0 @@ -24 diff --git a/update.sh b/update.sh deleted file mode 100644 index a31a630..0000000 --- a/update.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -set -eu - -# 平台按 schedule.conf 每 24 小时执行一次。 -SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) -TMP_FILE="$SCRIPT_DIR/data.json.tmp" -OUTPUT_FILE="$SCRIPT_DIR/data.json" - -rm -f "$TMP_FILE" -python3 "$SCRIPT_DIR/update_report_data.py" "$TMP_FILE" - -mv "$TMP_FILE" "$OUTPUT_FILE" -echo "Updated $OUTPUT_FILE" diff --git a/update_report_data.py b/update_report_data.py index e247384..e0cccfc 100644 --- a/update_report_data.py +++ b/update_report_data.py @@ -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"))