feat: 新增银行卡检查插件及相关依赖与配置文件
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
|
||||
个性化设计:
|
||||
- 通联登录账号密码由插件界面配置经 fields 注入(plugin_configs 本机保存,下次免填);
|
||||
- 登录方式可选:自动(接口优先/浏览器兜底)、仅接口登录、人工登录(弹浏览器由人工
|
||||
完成账号密码/验证码/安全验证,平台出现滑块或短信验证时使用);
|
||||
- 浏览器现场真登录(固定默认用户目录 + ddddocr 验证码识别),登录后转 requests.Session
|
||||
直调导出接口(服务端有 Referer 外链校验,插件内统一带 Referer);
|
||||
- 日期支持多个(逗号分隔,逐个导出);mode=日+月 时按日期串格式自动识别日/月;
|
||||
@@ -65,7 +67,7 @@ def _build_tasks(mode, day_date, month_date):
|
||||
class TongLianExportPlugin(ScenePlugin):
|
||||
id = "xq0045_xq0046"
|
||||
name = "金色印象通联数据导出"
|
||||
version = "1.0.12"
|
||||
version = "1.0.16"
|
||||
description = ("通联支付交易数据自动导出:XQ0045 按日 / XQ0046 按月,"
|
||||
"账号全量数据导出(含全部商户),服务端生成文件直存本地,"
|
||||
"并按商户分组自动拆分为综合门店/品牌管理公司/其他账号 3 个工作簿")
|
||||
@@ -83,6 +85,8 @@ class TongLianExportPlugin(ScenePlugin):
|
||||
"description": "留空=昨日(插件按执行日推算)"},
|
||||
"month_date": {"type": "string", "format": "month", "title": "按月导出", "default": "",
|
||||
"description": "留空=上月(插件按执行日推算)"},
|
||||
"login_mode": {"type": "string", "title": "登录方式", "default": config.LOGIN_AUTO,
|
||||
"enum": config.LOGIN_MODES},
|
||||
"tl_username": {"type": "string", "title": "通联登录账号", "default": ""},
|
||||
"tl_password": {"type": "string", "title": "通联登录密码", "default": ""},
|
||||
"save_dir": {"type": "string", "title": "保存目录", "default": ""},
|
||||
@@ -95,14 +99,21 @@ class TongLianExportPlugin(ScenePlugin):
|
||||
# ---------- 解析与校验 ----------
|
||||
mode = str(fields.get("mode") or MODE_BOTH).strip()
|
||||
content = str(fields.get("content") or CONTENT_BOTH).strip()
|
||||
login_mode = str(fields.get("login_mode") or config.LOGIN_AUTO).strip()
|
||||
username = str(fields.get("tl_username") or "").strip()
|
||||
password = str(fields.get("tl_password") or "")
|
||||
day_date = str(fields.get("day_date") or "").strip()
|
||||
month_date = str(fields.get("month_date") or "").strip()
|
||||
save_dir = str(fields.get("save_dir") or "").strip().strip('"') or _default_save_dir()
|
||||
|
||||
if not username or not password:
|
||||
raise RuntimeError("通联登录账号/密码缺失:请在插件界面填写并保存配置后重试")
|
||||
if login_mode not in config.LOGIN_MODES:
|
||||
ctx.log(f"未知登录方式 {login_mode!r},按「{config.LOGIN_AUTO}」处理")
|
||||
login_mode = config.LOGIN_AUTO
|
||||
if not username:
|
||||
raise RuntimeError("通联登录账号缺失:请在插件界面填写并保存配置后重试")
|
||||
if login_mode != config.LOGIN_MANUAL and not password:
|
||||
raise RuntimeError("通联登录密码缺失:请在插件界面填写并保存配置,"
|
||||
f"或把登录方式改为「{config.LOGIN_MANUAL}」(在浏览器里手输密码)")
|
||||
if mode not in (MODE_BOTH, MODE_DAY, MODE_MONTH):
|
||||
raise RuntimeError(f"未知执行模式:{mode}")
|
||||
if content not in (CONTENT_BOTH, CONTENT_TRX, CONTENT_BILL):
|
||||
@@ -124,10 +135,17 @@ class TongLianExportPlugin(ScenePlugin):
|
||||
|
||||
# ---------- 登录 ----------
|
||||
ctx.progress(3)
|
||||
ctx.log("开始通联平台登录(接口优先,浏览器兜底)…")
|
||||
session = allinpay_login.tl_login(username, password)
|
||||
if login_mode == config.LOGIN_MANUAL:
|
||||
ctx.log(f"开始通联平台登录(人工登录:将弹出浏览器,请在 {config.MANUAL_LOGIN_WAIT} 秒内"
|
||||
"完成账号密码/验证码/安全验证)…")
|
||||
else:
|
||||
ctx.log(f"开始通联平台登录({login_mode})…")
|
||||
session = allinpay_login.tl_login(username, password, login_mode)
|
||||
if session is None:
|
||||
raise RuntimeError("通联平台登录失败(账号密码错误或验证码多次识别失败),详见日志")
|
||||
hint = ("人工登录未完成(等待超时或浏览器被关闭),请重新执行并完成浏览器中的验证"
|
||||
if login_mode == config.LOGIN_MANUAL
|
||||
else "账号密码错误或验证码多次识别失败;若登录页出现安全验证,请把登录方式改为「人工登录」")
|
||||
raise RuntimeError(f"通联平台登录失败:{hint}。详见日志")
|
||||
ctx.progress(10)
|
||||
|
||||
saved, failed = [], []
|
||||
|
||||
Reference in New Issue
Block a user