feat: 优化支付码队列与支付超时

This commit is contained in:
yml
2026-11-13 21:21:19 +08:00
parent 76b344eb83
commit 8ba947e60f
11 changed files with 592 additions and 413 deletions
+2 -2
View File
@@ -99,7 +99,7 @@ def extract_pay_qr_code(html: str) -> str:
return code if is_alipay_url(code) else ""
def resolve_pay_targets(pay_url: str, *, timeout: float = 6.0) -> PayTargets:
def resolve_pay_targets(pay_url: str, *, timeout: float = 15.0) -> PayTargets:
"""跟随支付宝网关的 302,取**收银台页面**和页面里**真正的扫码内容**。
真机实测(2026-10-15):`openapi.alipay.com/gateway.do?...` 会 302 到
@@ -139,6 +139,6 @@ def resolve_pay_targets(pay_url: str, *, timeout: float = 6.0) -> PayTargets:
return PayTargets(cashier_url=final_url, qr_code=extract_pay_qr_code(html))
def resolve_pay_entry_url(pay_url: str, *, timeout: float = 6.0) -> str:
def resolve_pay_entry_url(pay_url: str, *, timeout: float = 15.0) -> str:
"""只要收银台直达地址(约 93 字符);解析不到返回空串。"""
return resolve_pay_targets(pay_url, timeout=timeout).cashier_url
+5 -1
View File
@@ -2,6 +2,7 @@
from __future__ import annotations
import os
import time
from datetime import UTC, datetime
from typing import TYPE_CHECKING, Any
@@ -18,7 +19,10 @@ HUYA_RECHARGE_ACT_ID = 25135
# shopAppInfo.scene(2026-10-13 积分中心抓包实测 7;订单侧 scene 由
# core.huya.wss_client.ORDER_SCENE 决定,两者不是同一个值)
HUYA_RECHARGE_APP_SCENE = SHOP_APP_SCENE
HUYA_PAYMENT_POLL_SECONDS = 180
HUYA_PAYMENT_POLL_SECONDS = max(
60,
int(os.getenv("HUYA_PAYMENT_POLL_SECONDS", "600")),
)
HUYA_PAYMENT_POLL_INTERVAL = 3
# 内置开通商品候选。**必须同时满足** getGoodsInfoV5=200(能看到)与
# listPayChannelV5=200(能买到)——真机(2026-10-15,hy_300546644 / uid 1199667339402):