restore: 恢复 11-06~11-09 本地未提交改动
- libs: 新增 hr_sdk / hotel_report / dingtalk,更新 desktopauto - controlplane-next: SDK 管理模块(controller/entity/migrations)与前端视图 - electron-shell: 插件同步、注册表、runner 调整 - plugins: XQ0035/XQ0041/XQ0042/XQ0045_XQ0046/XQ0048/XQ0076/XQ0078 等版本更新 - tests/tools: 新增 SDK 兼容性检查与打包工具(sdk_pack.py、sdk_compat_check.py)
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
"""临时校验:xq0079 人工登录通道能否打开登录页并预填账号密码(8 秒后自动超时,用完即删)。"""
|
||||
import importlib.util
|
||||
import os
|
||||
import sys
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
REPO = r"d:\work\code\37duAutomation"
|
||||
sys.path.insert(0, os.path.join(REPO, "desktop", "electron-shell", "python"))
|
||||
|
||||
PLUGIN_DIR = os.path.join(REPO, "plugins", "XQ0001-0100", "XQ0079 金色湖畔扫码数据导出")
|
||||
|
||||
spec = importlib.util.spec_from_file_location(
|
||||
"xq0079", os.path.join(PLUGIN_DIR, "__init__.py"),
|
||||
submodule_search_locations=[PLUGIN_DIR])
|
||||
mod = importlib.util.module_from_spec(spec)
|
||||
sys.modules["xq0079"] = mod
|
||||
spec.loader.exec_module(mod)
|
||||
|
||||
from xq0079 import config # noqa: E402
|
||||
from xq0079.data import tianque_browser # noqa: E402
|
||||
|
||||
config.set_log(lambda m, level="INFO": print(f"[{level}] {m}", flush=True))
|
||||
|
||||
print("登录选项:", config.LOGIN_MODE_CHOICES)
|
||||
result = tianque_browser.manual_login("13629779871", "Qq201201", wait_seconds=8)
|
||||
print("结果:", result.get("success"), result.get("message"))
|
||||
@@ -0,0 +1,33 @@
|
||||
"""临时校验:人工登录是否使用按账号隔离的浏览器用户目录(8 秒后超时,用完即删)。"""
|
||||
import importlib.util
|
||||
import os
|
||||
import sys
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
REPO = r"d:\work\code\37duAutomation"
|
||||
sys.path.insert(0, os.path.join(REPO, "desktop", "electron-shell", "python"))
|
||||
|
||||
PLUGIN_DIR = os.path.join(REPO, "plugins", "XQ0001-0100", "XQ0079 金色湖畔扫码数据导出")
|
||||
|
||||
spec = importlib.util.spec_from_file_location(
|
||||
"xq0079", os.path.join(PLUGIN_DIR, "__init__.py"),
|
||||
submodule_search_locations=[PLUGIN_DIR])
|
||||
mod = importlib.util.module_from_spec(spec)
|
||||
sys.modules["xq0079"] = mod
|
||||
spec.loader.exec_module(mod)
|
||||
|
||||
from xq0079 import config # noqa: E402
|
||||
from xq0079.data import tianque_browser # noqa: E402
|
||||
|
||||
config.set_log(lambda m, level="INFO": print(f"[{level}] {m}", flush=True))
|
||||
config.set_debug(True)
|
||||
|
||||
print("profile 根目录:", config.BROWSER_PROFILE_ROOT)
|
||||
print("账号A 目录:", config.get_profile_dir("13629779871"))
|
||||
print("账号B 目录:", config.get_profile_dir("17318298162"))
|
||||
|
||||
result = tianque_browser.manual_login("13629779871", "Qq201201", wait_seconds=6)
|
||||
print("结果:", result.get("success"), result.get("message"))
|
||||
print("临时公共目录是否被使用:", os.path.join(os.environ.get("TEMP", ""), "DrissionPage", "userData"))
|
||||
@@ -0,0 +1,40 @@
|
||||
"""临时:从已抓到的 packets.jsonl 里提取导出链路报文(紧凑版,用完即删)。"""
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "capture", "20261106-093603")
|
||||
OUT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "_dump_export.txt")
|
||||
|
||||
WANT = ("exportNew", "download/polling", "download/downLoadList", "download/look",
|
||||
"download/read", "download/downLoad/")
|
||||
seen = {}
|
||||
order = []
|
||||
for raw in open(os.path.join(ROOT, "packets.jsonl"), encoding="utf-8"):
|
||||
rec = json.loads(raw)
|
||||
path = rec["path"]
|
||||
if not any(k in path for k in WANT):
|
||||
continue
|
||||
key = (rec["method"], path if "download" not in path else path.split("/read/")[0].split("/downLoad/")[0])
|
||||
if key in seen:
|
||||
continue
|
||||
seen[key] = rec
|
||||
order.append(key)
|
||||
|
||||
lines = []
|
||||
for key in order:
|
||||
rec = seen[key]
|
||||
lines.append("-" * 90)
|
||||
lines.append(f"{rec['method']} {rec['url']}")
|
||||
lines.append(f" POST: {(rec['postData'] or '')[:900]}")
|
||||
body = rec.get("body") or ""
|
||||
lines.append(f" RESP({rec['size']}B) ct={rec['contentType']} bin={rec['binaryFile']}")
|
||||
lines.append(f" {body[:900]}")
|
||||
|
||||
text = "\n".join(lines)
|
||||
with open(OUT, "w", encoding="utf-8") as f:
|
||||
f.write(text)
|
||||
print(f"wrote {len(text)} chars, {len(order)} unique")
|
||||
@@ -0,0 +1,56 @@
|
||||
"""临时探针:拉前端 bundle,列出全部业务接口路径 + 报表相关路由(用完即删)。"""
|
||||
import os
|
||||
import re
|
||||
import ssl
|
||||
import sys
|
||||
|
||||
import requests
|
||||
from requests.adapters import HTTPAdapter
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
BASE = "https://mch-web.tianquetech.com"
|
||||
OUT = os.path.join(os.environ.get("TEMP", "."), "tianque_js")
|
||||
os.makedirs(OUT, exist_ok=True)
|
||||
|
||||
|
||||
class Low(HTTPAdapter):
|
||||
def init_poolmanager(self, *a, **kw):
|
||||
ctx = ssl.create_default_context()
|
||||
ctx.set_ciphers("DEFAULT@SECLEVEL=0")
|
||||
ctx.check_hostname = False
|
||||
ctx.verify_mode = ssl.CERT_NONE
|
||||
kw["ssl_context"] = ctx
|
||||
return super().init_poolmanager(*a, **kw)
|
||||
|
||||
|
||||
s = requests.Session()
|
||||
s.mount("https://", Low())
|
||||
s.headers.update({"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120.0.0.0 Safari/537.36"})
|
||||
r = s.get(BASE + "/login", timeout=30)
|
||||
srcs = re.findall(r'<script[^>]+src="([^"]+)"', r.text)
|
||||
text = ""
|
||||
for src in srcs:
|
||||
url = src if src.startswith("http") else BASE + ("" if src.startswith("/") else "/") + src
|
||||
text += s.get(url, timeout=30).text
|
||||
|
||||
cache = os.path.join(OUT, "all.js")
|
||||
open(cache, "w", encoding="utf-8", errors="replace").write(text)
|
||||
|
||||
apis = sorted(set(re.findall(r'"(/?management/easypay/api/[A-Za-z0-9_/\-]+)"', text)))
|
||||
print(f"### 接口共 {len(apis)}")
|
||||
for p in apis:
|
||||
print(" " + p)
|
||||
|
||||
KW = ("report", "bill", "settle", "download", "export", "tranInfo", "statis", "sum", "statement", "check")
|
||||
print("\n### 报表/对账/导出相关")
|
||||
for p in apis:
|
||||
if any(k.lower() in p.lower() for k in KW):
|
||||
print(" " + p)
|
||||
|
||||
routes = sorted(set(re.findall(r'path:"(/[A-Za-z0-9_/\-]{2,40})"', text)))
|
||||
print(f"\n### 路由共 {len(routes)}")
|
||||
for p in routes:
|
||||
if any(k in p.lower() for k in ("report", "bill", "settle", "tran", "download", "statis", "check", "account")):
|
||||
print(" " + p)
|
||||
@@ -0,0 +1,23 @@
|
||||
"""临时探针:只看报表/对账/导出相关接口与路由(用完即删)。"""
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
cache = os.path.join(os.environ.get("TEMP", "."), "tianque_js", "all.js")
|
||||
text = open(cache, encoding="utf-8", errors="replace").read()
|
||||
|
||||
apis = sorted(set(re.findall(r'"(/?management/easypay/api/[A-Za-z0-9_/\-]+)"', text)))
|
||||
KW = ("report", "bill", "settle", "download", "export", "tranInfo", "statis", "sum", "statement", "check", "voucher", "order")
|
||||
print("### 报表/对账/导出相关接口")
|
||||
for p in apis:
|
||||
if any(k.lower() in p.lower() for k in KW):
|
||||
print(" " + p)
|
||||
|
||||
routes = sorted(set(re.findall(r'path:"(/[A-Za-z0-9_/\-]{2,60})"', text)))
|
||||
print(f"\n### 相关路由(共 {len(routes)} 条路由)")
|
||||
for p in routes:
|
||||
if any(k in p.lower() for k in ("report", "bill", "settle", "tran", "download", "statis", "check", "voucher", "order")):
|
||||
print(" " + p)
|
||||
@@ -0,0 +1,24 @@
|
||||
"""临时验证:故意提交错误验证码,看服务端错误码,用于区分「验证码错」和「密码错」(用完即删)。"""
|
||||
import json
|
||||
import sys
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
import tianque_login_test as m
|
||||
|
||||
URL_NEW = "/management/easypay/api/user/transForm/login"
|
||||
|
||||
s = m.new_session()
|
||||
key, img = m.fetch_captcha(s)
|
||||
print("imageKey =", key)
|
||||
|
||||
for url, label in ((URL_NEW, "transForm/login"), (m.URL_LOGIN, "bankLogin/loginByAccount")):
|
||||
resp = m.post_json(s, url, {
|
||||
"loginAcc": m.ACCOUNT,
|
||||
"loginPwd": m.enc_password(m.PASSWORD),
|
||||
"imageCode": "0000",
|
||||
"imageKey": key,
|
||||
})
|
||||
print(f"[{label}] 错误验证码 -> {json.dumps(resp, ensure_ascii=False)[:300]}")
|
||||
key, img = m.fetch_captcha(s)
|
||||
@@ -0,0 +1,33 @@
|
||||
"""临时验证:对比「扁平 body」与「{header,data} 信封 body」两种提交方式(用完即删)。"""
|
||||
import json
|
||||
import sys
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
import tianque_login_test as m
|
||||
|
||||
URL_NEW = "/management/easypay/api/user/transForm/login"
|
||||
URL_OLD = "/management/easypay/api/bankLogin/loginByAccount"
|
||||
|
||||
|
||||
def submit(session, url, wrapped, code, key):
|
||||
inner = {
|
||||
"loginAcc": m.ACCOUNT.strip(),
|
||||
"loginPwd": m.enc_password(m.PASSWORD.strip()),
|
||||
"imageCode": code,
|
||||
"imageKey": key,
|
||||
}
|
||||
payload = {"header": {"sysType": "pc"}, "data": inner} if wrapped else inner
|
||||
return m.post_json(session, url, payload)
|
||||
|
||||
|
||||
for url, wrapped in ((URL_NEW, True), (URL_NEW, False), (URL_OLD, True)):
|
||||
s = m.new_session()
|
||||
s.headers["omp_sui_pc"] = "pc"
|
||||
key, img = m.fetch_captcha(s)
|
||||
code = m.ocr_image(img)
|
||||
ok = m.ocr_code_ok(code)
|
||||
resp = submit(s, url, wrapped, code, key)
|
||||
print(f"\n[{url}] wrapped={wrapped} OCR={code!r} 格式OK={ok}")
|
||||
print(json.dumps(resp, ensure_ascii=False)[:400])
|
||||
@@ -0,0 +1,60 @@
|
||||
"""临时探针:抓前端 JS bundle,定位登录密码加密实现与请求字段(用完即删)。"""
|
||||
import os
|
||||
import re
|
||||
import ssl
|
||||
import sys
|
||||
|
||||
import requests
|
||||
from requests.adapters import HTTPAdapter
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
BASE = "https://mch-web.tianquetech.com"
|
||||
OUT = os.path.join(os.environ.get("TEMP", "."), "tianque_js")
|
||||
|
||||
|
||||
class Low(HTTPAdapter):
|
||||
def init_poolmanager(self, *a, **kw):
|
||||
ctx = ssl.create_default_context()
|
||||
ctx.set_ciphers("DEFAULT@SECLEVEL=0")
|
||||
ctx.check_hostname = False
|
||||
ctx.verify_mode = ssl.CERT_NONE
|
||||
kw["ssl_context"] = ctx
|
||||
return super().init_poolmanager(*a, **kw)
|
||||
|
||||
|
||||
s = requests.Session()
|
||||
s.mount("https://", Low())
|
||||
s.headers.update({"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120.0.0.0 Safari/537.36"})
|
||||
os.makedirs(OUT, exist_ok=True)
|
||||
|
||||
r = s.get(BASE + "/login", timeout=30)
|
||||
print("login page", r.status_code, len(r.text))
|
||||
open(os.path.join(OUT, "login.html"), "w", encoding="utf-8").write(r.text)
|
||||
|
||||
srcs = re.findall(r'<script[^>]+src="([^"]+)"', r.text)
|
||||
print("scripts:", len(srcs))
|
||||
hits = []
|
||||
for src in srcs:
|
||||
url = src if src.startswith("http") else BASE + ("" if src.startswith("/") else "/") + src
|
||||
try:
|
||||
resp = s.get(url, timeout=30)
|
||||
except Exception as exc:
|
||||
print("skip", url, exc)
|
||||
continue
|
||||
name = os.path.basename(url.split("?")[0])
|
||||
path = os.path.join(OUT, name)
|
||||
open(path, "w", encoding="utf-8", errors="replace").write(resp.text)
|
||||
print(f" {name} {resp.status_code} {len(resp.text)}")
|
||||
for kw in ("loginPwd", "loginByAccount", "abcdefgabcdefg12", "imageKey"):
|
||||
if kw in resp.text:
|
||||
hits.append((name, kw))
|
||||
|
||||
print("kw hits:", hits)
|
||||
for name, kw in hits:
|
||||
text = open(os.path.join(OUT, name), encoding="utf-8", errors="replace").read()
|
||||
for m in re.finditer(kw, text):
|
||||
seg = text[max(0, m.start() - 400): m.start() + 400]
|
||||
print("=" * 30, name, kw)
|
||||
print(seg.replace("\n", " "))
|
||||
@@ -0,0 +1,31 @@
|
||||
"""临时探针 2:分析已下载 bundle 中的加密实现与接口地址(用完即删)。"""
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
JS = os.path.join(os.environ.get("TEMP", "."), "tianque_js", "umi.4ba392fc.js")
|
||||
text = open(JS, encoding="utf-8", errors="replace").read()
|
||||
print("len", len(text))
|
||||
|
||||
|
||||
def show(kw, before=600, after=1200, limit=3):
|
||||
print("\n" + "#" * 40, kw)
|
||||
n = 0
|
||||
for m in re.finditer(re.escape(kw), text):
|
||||
print("-" * 20, f"@{m.start()}")
|
||||
print(text[max(0, m.start() - before): m.start() + after].replace("\n", " "))
|
||||
n += 1
|
||||
if n >= limit:
|
||||
break
|
||||
if not n:
|
||||
print("(not found)")
|
||||
|
||||
|
||||
show("abcdefgabcdefg12")
|
||||
show("transForm/login", 800, 400)
|
||||
show("bankLogin", 300, 300, 2)
|
||||
show("mode:r.ECB", 600, 300, 2)
|
||||
show("ECB", 300, 300, 3)
|
||||
@@ -0,0 +1,32 @@
|
||||
"""临时探针 3:列出 bundle 里所有接口路径 + transForm/login 提交上下文(用完即删)。"""
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
JS = os.path.join(os.environ.get("TEMP", "."), "tianque_js", "umi.4ba392fc.js")
|
||||
text = open(JS, encoding="utf-8", errors="replace").read()
|
||||
|
||||
paths = sorted(set(re.findall(r'"(/management/easypay/api/[^"]+)"', text)))
|
||||
print("### 接口路径", len(paths))
|
||||
for p in paths:
|
||||
print(" ", p)
|
||||
|
||||
print("\n### bankLogin 相关")
|
||||
for p in paths:
|
||||
if "bankLogin" in p:
|
||||
print(" HIT", p)
|
||||
|
||||
print("\n### getImage 定义")
|
||||
for m in re.finditer(r'getImage', text):
|
||||
seg = text[max(0, m.start() - 200): m.start() + 400]
|
||||
if "url" in seg or "/api/" in seg:
|
||||
print("-" * 20, m.start())
|
||||
print(seg.replace("\n", " "))
|
||||
|
||||
print("\n### transForm/login 上下文")
|
||||
for m in re.finditer(r'transForm/login', text):
|
||||
print("-" * 20, m.start())
|
||||
print(text[max(0, m.start() - 1500): m.start() + 300].replace("\n", " "))
|
||||
@@ -0,0 +1,29 @@
|
||||
"""临时探针 4:登录表单字段名、请求头封装、transForm/login 失败分支(用完即删)。"""
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
JS = os.path.join(os.environ.get("TEMP", "."), "tianque_js", "umi.4ba392fc.js")
|
||||
text = open(JS, encoding="utf-8", errors="replace").read()
|
||||
|
||||
|
||||
def show(kw, before=300, after=900, limit=4, label=None):
|
||||
print("\n" + "#" * 30, label or kw)
|
||||
n = 0
|
||||
for m in re.finditer(re.escape(kw), text):
|
||||
print("-" * 15, f"@{m.start()}")
|
||||
print(text[max(0, m.start() - before): m.start() + after].replace("\n", " "))
|
||||
n += 1
|
||||
if n >= limit:
|
||||
break
|
||||
if not n:
|
||||
print("(not found)")
|
||||
|
||||
|
||||
show('"imageCode"', 400, 900, 4, "imageCode 字段")
|
||||
show("channel", 300, 500, 3, "channel 请求头")
|
||||
show("sysType", 300, 400, 3, "sysType 请求头")
|
||||
show("errorType", 400, 600, 5, "errorType 处理")
|
||||
@@ -0,0 +1,24 @@
|
||||
"""临时探针 5:请求头封装(channel / sysType 等)(用完即删)。"""
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
JS = os.path.join(os.environ.get("TEMP", "."), "tianque_js", "umi.4ba392fc.js")
|
||||
text = open(JS, encoding="utf-8", errors="replace").read()
|
||||
|
||||
print("### channel 上下文")
|
||||
for m in re.finditer(r'channel', text):
|
||||
seg = text[max(0, m.start() - 250): m.start() + 250]
|
||||
if "header" in seg or "WELIFE" in seg or "sysType" in seg:
|
||||
print("-" * 15, m.start())
|
||||
print(seg.replace("\n", " "))
|
||||
|
||||
print("\n### sysType 上下文")
|
||||
for m in re.finditer(r'sysType', text):
|
||||
seg = text[max(0, m.start() - 250): m.start() + 250]
|
||||
if "header" in seg or "pc" in seg:
|
||||
print("-" * 15, m.start())
|
||||
print(seg.replace("\n", " "))
|
||||
@@ -0,0 +1,10 @@
|
||||
"""临时探针 6:打印请求封装函数全文,确认 POST body 信封结构(用完即删)。"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
JS = os.path.join(os.environ.get("TEMP", "."), "tianque_js", "umi.4ba392fc.js")
|
||||
text = open(JS, encoding="utf-8", errors="replace").read()
|
||||
print(text[5419000:5427000])
|
||||
@@ -0,0 +1,14 @@
|
||||
"""临时探针 7:探针接口参数(用完即删)。"""
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
JS = os.path.join(os.environ.get("TEMP", "."), "tianque_js", "umi.4ba392fc.js")
|
||||
text = open(JS, encoding="utf-8", errors="replace").read()
|
||||
|
||||
for m in re.finditer(r'queryTranSumByDate', text):
|
||||
print("-" * 20, m.start())
|
||||
print(text[max(0, m.start() - 700): m.start() + 700].replace("\n", " "))
|
||||
@@ -0,0 +1,11 @@
|
||||
"""临时验证:用前端真实接口 transForm/login 提交一次(用完即删)。"""
|
||||
import sys
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
import tianque_login_test as m
|
||||
|
||||
m.MAX_ATTEMPTS = int(sys.argv[1]) if len(sys.argv) > 1 else 2
|
||||
m.URL_LOGIN = "/management/easypay/api/user/transForm/login"
|
||||
sys.exit(0 if m.main() else 1)
|
||||
@@ -0,0 +1,28 @@
|
||||
"""临时验证:token 探针接口的 body 形态(flat / 信封)(用完即删)。"""
|
||||
import json
|
||||
import sys
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
import tianque_login_test as m
|
||||
|
||||
s = m.new_session()
|
||||
key, img = m.fetch_captcha(s)
|
||||
code = m.ocr_image(img)
|
||||
resp = m.do_login(s, m.ACCOUNT, m.PASSWORD, key, code)
|
||||
data = (resp.get("data") or {}).get("users") or []
|
||||
if not data:
|
||||
print("登录失败", json.dumps(resp, ensure_ascii=False)[:200])
|
||||
sys.exit(1)
|
||||
token = data[0]["token"]
|
||||
s.headers["token"] = token
|
||||
print("token =", token[:12], "...")
|
||||
|
||||
for label, payload in (
|
||||
("信封", m.envelope({"queryType": "D"})),
|
||||
("扁平", {"queryType": "D"}),
|
||||
("日期+信封", m.envelope({"queryType": "D", "startDate": "", "endDate": ""})),
|
||||
):
|
||||
r = m.post_json(s, m.URL_PROBE, payload)
|
||||
print(f"[{label}] {json.dumps(r, ensure_ascii=False)[:200]}")
|
||||
@@ -0,0 +1,46 @@
|
||||
"""临时联调:按壳子方式加载 xq0079 并跑 run(login_mode=人工登录,缓存 token 有效时应直接复用)。"""
|
||||
import importlib.util
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
REPO = r"d:\work\code\37duAutomation"
|
||||
sys.path.insert(0, os.path.join(REPO, "desktop", "electron-shell", "python"))
|
||||
|
||||
PLUGIN_DIR = os.path.join(REPO, "plugins", "XQ0001-0100", "XQ0079 金色湖畔扫码数据导出")
|
||||
|
||||
|
||||
class FakeCtx:
|
||||
def log(self, msg, level="INFO"):
|
||||
print(f"[{level}] {msg}", flush=True)
|
||||
|
||||
def progress(self, pct):
|
||||
pass
|
||||
|
||||
|
||||
spec = importlib.util.spec_from_file_location(
|
||||
"xq0079", os.path.join(PLUGIN_DIR, "__init__.py"),
|
||||
submodule_search_locations=[PLUGIN_DIR])
|
||||
mod = importlib.util.module_from_spec(spec)
|
||||
sys.modules["xq0079"] = mod
|
||||
spec.loader.exec_module(mod)
|
||||
|
||||
plugin = mod.PLUGINS.find("xq0079")
|
||||
fields = {
|
||||
"tq_account1": "13629779871",
|
||||
"tq_password1": "Qq201201",
|
||||
"tq_account2": "",
|
||||
"tq_password2": "",
|
||||
"login_mode": "人工登录",
|
||||
"date_from": "",
|
||||
"date_to": "",
|
||||
"save_dir": os.path.join(tempfile.gettempdir(), "xq0079_test"),
|
||||
"debug_mode": False,
|
||||
}
|
||||
result = plugin.run(fields, FakeCtx())
|
||||
print("\nsummary:", result.get("summary"))
|
||||
for note in result.get("notes") or []:
|
||||
print("note:", note)
|
||||
@@ -0,0 +1,15 @@
|
||||
"""临时冒烟:小范围跑一次报表监听(1 个路由、短超时),验证监听链路(用完即删)。"""
|
||||
import sys
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
import tianque_report_capture as R
|
||||
|
||||
R.MODE = "auto"
|
||||
R.REPORT_ROUTES = [("交易趋势", "/report/trend")]
|
||||
R.PAGE_WAIT = 8
|
||||
R.PAGE_LISTEN = 12
|
||||
R.IDLE_SECONDS = 6
|
||||
R.MAX_SECONDS = 60
|
||||
sys.exit(0 if R.main() else 1)
|
||||
Reference in New Issue
Block a user