feat: 重做协作台账状态机并支持充值核账
This commit is contained in:
@@ -1239,12 +1239,25 @@ class HuyaHttpClient:
|
||||
# ============================================================
|
||||
|
||||
@staticmethod
|
||||
def _raw_from_wup(wup_resp: WupResponse):
|
||||
def _raw_from_wup(
|
||||
wup_resp: WupResponse,
|
||||
*,
|
||||
max_depth: int = 5,
|
||||
keep_bytes: bool = False,
|
||||
):
|
||||
"""已解码的 WUP 响应 → ShopRawRsp(未逐字段建模的接口用)。"""
|
||||
from .shop_structs import ShopRawRsp
|
||||
|
||||
data = wup_resp.newdata.get("tRsp") or wup_resp.newdata.get("tResp")
|
||||
payload = decode_struct_bytes(data) if isinstance(data, bytes) else {}
|
||||
payload = (
|
||||
decode_struct_bytes(
|
||||
data,
|
||||
max_depth=max_depth,
|
||||
keep_bytes=keep_bytes,
|
||||
)
|
||||
if isinstance(data, bytes)
|
||||
else {}
|
||||
)
|
||||
return ShopRawRsp.from_payload(payload)
|
||||
|
||||
def get_supplier_info(
|
||||
@@ -1339,8 +1352,14 @@ class HuyaHttpClient:
|
||||
source_id: str = "yellowcarlist",
|
||||
page_code: str = "heping_baodian_credit_center_page",
|
||||
timeout: float = 15.0,
|
||||
*,
|
||||
deep: bool = False,
|
||||
):
|
||||
"""PlayMallUI.queryAllocation(积分中心配额查询)。"""
|
||||
"""PlayMallUI.queryAllocation(积分中心配额查询)。
|
||||
|
||||
``deep=True`` 时保留 ``tag2[].tag5`` 的原始字节并放宽解码深度,
|
||||
供 :func:`core.huya.shop_structs.parse_points_center_gifts` 解析商品列表。
|
||||
"""
|
||||
from .shop_structs import PlayMallQueryAllocationReq
|
||||
|
||||
req = PlayMallQueryAllocationReq()
|
||||
@@ -1357,7 +1376,13 @@ class HuyaHttpClient:
|
||||
cookie,
|
||||
timeout=timeout,
|
||||
)
|
||||
return self._raw_from_wup(resp) if isinstance(resp, WupResponse) else None
|
||||
if not isinstance(resp, WupResponse):
|
||||
return None
|
||||
return self._raw_from_wup(
|
||||
resp,
|
||||
max_depth=40 if deep else 5,
|
||||
keep_bytes=deep,
|
||||
)
|
||||
|
||||
def play_mall_get_my_promotion(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user