Compare commits

...
3 Commits
Author SHA1 Message Date
SHAREit 4ef5d5f1a7 Refresh report data (manual update) 2026-08-27 11:40:28 +08:00
SHAREit f62a78b8ca Update report UI and month-to-date metrics 2026-08-27 11:35:22 +08:00
SHAREit fc3fdb4764 Update report UI and month-to-date metrics 2026-08-26 18:13:15 +08:00
4 changed files with 6 additions and 14 deletions
+3 -1
View File
@@ -1,5 +1,7 @@
<!doctype html> <!doctype html>
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Ozon 投放表现</title> <html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Expires" content="0">
<title>Ozon 投放表现</title>
<style> <style>
:root{--bg:#f4f7fb;--card:#fff;--text:#14213d;--muted:#6b7280;--line:#e5eaf1;--blue:#5577ee;--green:#23a673;--pink:#e4568b} :root{--bg:#f4f7fb;--card:#fff;--text:#14213d;--muted:#6b7280;--line:#e5eaf1;--blue:#5577ee;--green:#23a673;--pink:#e4568b}
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,"Microsoft YaHei",system-ui,sans-serif} *{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,"Microsoft YaHei",system-ui,sans-serif}
-1
View File
@@ -1 +0,0 @@
24
-11
View File
@@ -1,11 +0,0 @@
#!/bin/sh
set -eu
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
TMP_FILE="$SCRIPT_DIR/data.json.tmp"
OUTPUT_FILE="$SCRIPT_DIR/data.json"
python3 "$SCRIPT_DIR/update_report_data.py" "$TMP_FILE"
mv "$TMP_FILE" "$OUTPUT_FILE"
echo "Updated $OUTPUT_FILE"
+3 -1
View File
@@ -244,11 +244,13 @@ def build_payload(rows, now):
def main(): def main():
if len(sys.argv) < 2: if len(sys.argv) < 2:
raise SystemExit("用法: update_report_data.py <输出文件>") raise SystemExit("用法: update_report_data.py <输出文件>")
now = datetime.now(TIMEZONE)
request = urllib.request.Request(CSV_URL, headers={"User-Agent": "AgentStage-Ozon-Report/2.0"}) request = urllib.request.Request(CSV_URL, headers={"User-Agent": "AgentStage-Ozon-Report/2.0"})
with urllib.request.urlopen(request, timeout=90) as response: with urllib.request.urlopen(request, timeout=90) as response:
text = response.read().decode("utf-8-sig") text = response.read().decode("utf-8-sig")
rows = list(csv.reader(text.splitlines())) rows = list(csv.reader(text.splitlines()))
payload = build_payload(rows, datetime.now(TIMEZONE)) payload = build_payload(rows, now)
with open(sys.argv[1], "w", encoding="utf-8") as handle: with open(sys.argv[1], "w", encoding="utf-8") as handle:
json.dump(payload, handle, ensure_ascii=False, indent=2) json.dump(payload, handle, ensure_ascii=False, indent=2)
period = payload["period"] period = payload["period"]