Publish King campaign report (manual update)

This commit is contained in:
SHAREit
2026-08-27 15:43:25 +08:00
parent e2882a4916
commit 51603ba251
4 changed files with 13 additions and 14 deletions
+1
View File
@@ -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('<b style="color:#b45309">Cost 沿用上次抓取值,需本地重新抓取才会更新</b>');
if(Array.isArray(sands.missing_pkgs)&&sands.missing_pkgs.length)
notes.push(`<b style="color:#b42318">Cost 不完整,缺少包:${esc(sands.missing_pkgs.join(', '))}</b>`);
}
-1
View File
@@ -1 +0,0 @@
24
-13
View File
@@ -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"
+12
View File
@@ -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"))