接入虎牙精英宝典最新商城前置流程

This commit is contained in:
yml2213
2026-09-01 11:42:52 +08:00
parent 684e16a07a
commit eb065a7c77
6 changed files with 243 additions and 2 deletions
@@ -434,6 +434,35 @@ class RechargeMixin:
)
return
protocol = client.check_hy_protocol(uid=uid, guid="", cookie=cookie)
if protocol is None or protocol.code != 200:
self._mark_task(
worker_db, task, "failed",
getattr(protocol, "message", "商城协议校验失败") or "商城协议校验失败",
{"goods": detail, "protocol": protocol.to_dict() if protocol else None},
)
return
channels = client.list_pay_channels(
uid=uid, guid="", cookie=cookie, spu_id=spu_id, sku_id=0
)
available_channels = set(getattr(channels, "channels", []) or [])
if channels is None or channels.code != 200 or pay_channel not in available_channels:
self._mark_task(
worker_db, task, "failed", "当前支付渠道不可用",
{"goods": detail, "channels": channels.to_dict() if channels else None},
)
return
auth = client.check_user_buy_auth(
uid=uid, guid="", cookie=cookie, spu_id=spu_id, sku_id=sku_id
)
if auth is None or auth.code != 200:
self._mark_task(
worker_db, task, "failed",
getattr(auth, "message", "购买权限校验失败") or "购买权限校验失败",
{"goods": detail, "auth": auth.to_dict() if auth else None},
)
return
order_resp = client.create_order(
uid=uid,
guid="",