区分斗鱼充值审计方式
This commit is contained in:
@@ -52,7 +52,20 @@ def _audit_log_out(db: Session, row: AuditLog) -> dict:
|
||||
for task, account in accounts
|
||||
]
|
||||
detail["recharge_accounts_truncated"] = len(accounts) == 100
|
||||
detail_text = json.dumps(detail, ensure_ascii=False, separators=(",", ":"))
|
||||
if isinstance(detail, dict) and not detail.get("payment_method"):
|
||||
batch_id = row.target.removeprefix("douyu_batch:")
|
||||
task = (
|
||||
db.query(DouyuTask)
|
||||
.filter(DouyuTask.batch_id == batch_id, DouyuTask.task_type == "create_gold_qr")
|
||||
.order_by(DouyuTask.id.asc())
|
||||
.first()
|
||||
)
|
||||
task_result = task.result if task and isinstance(task.result, dict) else {}
|
||||
recharge_channel = str(task_result.get("recharge_channel") or "wechat_qr")
|
||||
detail["recharge_channel"] = recharge_channel
|
||||
detail["payment_method"] = "API 直充支付" if recharge_channel == "supplier_api" else "微信扫码支付"
|
||||
if isinstance(detail, dict):
|
||||
detail_text = json.dumps(detail, ensure_ascii=False, separators=(",", ":"))
|
||||
return {
|
||||
"id": row.id,
|
||||
"user_id": row.user_id,
|
||||
|
||||
@@ -497,6 +497,11 @@ async def create_task_batch(
|
||||
raise HTTPException(status_code=400, detail="没有可执行的斗鱼账号,请先登录获取 Cookie")
|
||||
|
||||
if req.task_type == "create_gold_qr":
|
||||
config = ensure_douyu_config(db)
|
||||
recharge_channel = str(
|
||||
douyu_config_value("gold_recharge_channel", config.gold_recharge_channel)
|
||||
).strip()
|
||||
payment_method = "API 直充支付" if recharge_channel == "supplier_api" else "微信扫码支付"
|
||||
recharge_accounts = (
|
||||
db.query(DouyuTask, Account)
|
||||
.join(Account, Account.id == DouyuTask.account_id)
|
||||
@@ -510,6 +515,8 @@ async def create_task_batch(
|
||||
detail={
|
||||
"batch_id": batch_id, "task_type": req.task_type, "count": count,
|
||||
"account_count": len(req.account_ids), "handbook_scope": req.handbook_scope,
|
||||
"recharge_channel": recharge_channel,
|
||||
"payment_method": payment_method,
|
||||
# 仅记录充值身份,禁止在审计中写入 Cookie、密码等凭据。
|
||||
"recharge_accounts": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user