Publish King campaign report (manual update)
This commit is contained in:
@@ -249,6 +249,7 @@ function renderPerformance(){
|
|||||||
else{
|
else{
|
||||||
if(sands.fetched_at)notes.push(`Sands Cost 抓取于 ${esc(String(sands.fetched_at).replace('T',' '))},不随每日自动更新`);
|
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.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)
|
if(Array.isArray(sands.missing_pkgs)&&sands.missing_pkgs.length)
|
||||||
notes.push(`<b style="color:#b42318">Cost 不完整,缺少包:${esc(sands.missing_pkgs.join(', '))}</b>`);
|
notes.push(`<b style="color:#b42318">Cost 不完整,缺少包:${esc(sands.missing_pkgs.join(', '))}</b>`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
24
|
|
||||||
@@ -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"
|
|
||||||
@@ -364,6 +364,18 @@ def load_sands_cost():
|
|||||||
]
|
]
|
||||||
path = next((item for item in candidates if item.exists()), None)
|
path = next((item for item in candidates if item.exists()), None)
|
||||||
if path is 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,将留空")
|
print(" Sands Cost:未找到 sands_cost.json,将留空")
|
||||||
return None
|
return None
|
||||||
data = json.loads(path.read_text(encoding="utf-8"))
|
data = json.loads(path.read_text(encoding="utf-8"))
|
||||||
|
|||||||
Reference in New Issue
Block a user