Files
Neo-ZQYY/scripts/ops/resubmit_v7.py

58 lines
2.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""第七次执行:修复 BUG 8pay_money/gift_money → pay_amount/point_amount"""
import json
import sys
from pathlib import Path
import requests
from dotenv import load_dotenv
load_dotenv(Path(__file__).resolve().parents[2] / ".env")
BASE = "http://localhost:8000"
TOKEN_FILE = Path(__file__).parent / ".monitor_token"
REFRESH_TOKEN = (
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9."
"eyJzdWIiOiIxIiwic2l0ZV9pZCI6Mjc5MDY4NTQxNTQ0MzI2OSwidHlwZSI6InJlZnJlc2giLCJleHAiOjE3NzIyNjM0NjN9."
"XYoda5lfxNtTSAGWoLlYhS9cA-hTK9iqK0SqUyn2KV4"
)
# 刷新 token
resp = requests.post(f"{BASE}/api/auth/refresh", json={"refresh_token": REFRESH_TOKEN}, timeout=10)
if resp.status_code != 200:
print(f"刷新失败: {resp.status_code} {resp.text}")
sys.exit(1)
token = resp.json()["access_token"]
TOKEN_FILE.write_text(token, encoding="utf-8")
print("token 已刷新")
headers = {"Authorization": f"Bearer {token}", "Content-Type": "application/json"}
payload = {
"tasks": [
"ODS_FETCH", "DWD_LOAD_FROM_ODS",
"DWS_ASSISTANT_DAILY", "DWS_ASSISTANT_MONTHLY",
"DWS_ASSISTANT_CUSTOMER", "DWS_ASSISTANT_SALARY",
"DWS_ASSISTANT_FINANCE",
"DWS_MEMBER_CONSUMPTION", "DWS_MEMBER_VISIT",
"DWS_GOODS_STOCK_DAILY", "DWS_GOODS_STOCK_WEEKLY", "DWS_GOODS_STOCK_MONTHLY",
"DWS_FINANCE_DAILY", "DWS_FINANCE_RECHARGE",
"DWS_FINANCE_INCOME_STRUCTURE", "DWS_FINANCE_DISCOUNT_DETAIL",
"DWS_WINBACK_INDEX", "DWS_NEWCONV_INDEX", "DWS_RELATION_INDEX",
],
"flow": "api_full",
"processing_mode": "full_window",
"date_range": {"start": "2025-11-01", "end": "2026-02-20"},
"window_days": 30,
"force_full": True,
}
r = requests.post(f"{BASE}/api/execution/run", headers=headers, json=payload, timeout=30)
print(f"status={r.status_code}")
data = r.json()
print(json.dumps(data, ensure_ascii=False, indent=2))
if r.status_code == 200:
eid = data.get("execution_id") or data.get("id")
print(f"\nexecution_id: {eid}")