fix(huya): 查询积分改走积分中心新接口(含成长等级)
旧活动接口 webActUI.getUserScore 对任何 sid 都返回 603「活动已结束」 (接口已下线,与工作台 SID/活动配置无关),刷新积分只会报错。 - 协议层新增两个 RPC(WSS + HTTP 双侧同签名): shopMiddleUI.getRedeemNeedGoods(tag2=当前积分、tag3=兑换门槛, 兑换商品号 POINTS_REDEEM_GOODS_NUM=8315982,传错直接 500) 与 GameBizUI.getGrowLevelUserInfo(成长值/成长等级/昵称/头像) - 新增结构体 GetRedeemNeedGoodsReq / GetGrowLevelUserInfoReq, 与 HuyaEliteWssSession 透传 - 服务层 _execute_query_points 主源改为积分中心接口,结果带 points/redeem_threshold/grow_level/grow_value,并同步 account.points; 接口无响应时才回退旧活动接口并如实报告其 603 返回 - 开通支付成功后的积分刷新同样改走积分中心接口 - 前端任务页积分结果优先读 points(兼容旧记录的 available_score), 并在有成长等级时一并展示 - 新增 tests/test_huya_points_query.py:真机响应字节回归 + 请求参数 字面量断言 + 服务层积分来源/回退语义(已做反向验证) 真机验证:HTTP 通道取到积分 280 / 门槛 20 / 成长等级 3
This commit is contained in:
@@ -29,6 +29,7 @@ from .wss_client import (
|
||||
ORDER_BIZ_TYPE,
|
||||
ORDER_SCENE,
|
||||
POINTS_PAY_CALLBACK,
|
||||
POINTS_REDEEM_GOODS_NUM,
|
||||
SHOP_APP_SCENE,
|
||||
)
|
||||
from .wup_protocol import WupRequest, WupResponse
|
||||
@@ -1448,6 +1449,53 @@ class HuyaHttpClient:
|
||||
)
|
||||
return self._raw_from_wup(resp) if isinstance(resp, WupResponse) else None
|
||||
|
||||
def get_redeem_need_goods(
|
||||
self,
|
||||
uid: int,
|
||||
guid: str,
|
||||
cookie: str,
|
||||
goods_num: int = POINTS_REDEEM_GOODS_NUM,
|
||||
timeout: float = 15.0,
|
||||
):
|
||||
"""shopMiddleUI.getRedeemNeedGoods(当前积分 tag2 / 兑换门槛 tag3)。"""
|
||||
from .shop_structs import GetRedeemNeedGoodsReq
|
||||
|
||||
req = GetRedeemNeedGoodsReq()
|
||||
req.userId = self._build_shop_user(uid, cookie)
|
||||
req.shopAppInfo = self._build_shop_app("yellowcarlist", SHOP_APP_SCENE)
|
||||
req.goodsNum = int(goods_num or 0)
|
||||
resp = self.call_rpc(
|
||||
"shopMiddleUI",
|
||||
"getRedeemNeedGoods",
|
||||
req,
|
||||
None,
|
||||
uid,
|
||||
guid,
|
||||
cookie,
|
||||
timeout=timeout,
|
||||
)
|
||||
return self._raw_from_wup(resp) if isinstance(resp, WupResponse) else None
|
||||
|
||||
def get_grow_level_user_info(
|
||||
self, uid: int, guid: str, cookie: str, timeout: float = 15.0
|
||||
):
|
||||
"""GameBizUI.getGrowLevelUserInfo(成长值 tag1.tag0 / 等级 tag1.tag1)。"""
|
||||
from .shop_structs import GetGrowLevelUserInfoReq
|
||||
|
||||
req = GetGrowLevelUserInfoReq()
|
||||
req.userId = self._build_shop_user(uid, cookie)
|
||||
resp = self.call_rpc(
|
||||
"GameBizUI",
|
||||
"getGrowLevelUserInfo",
|
||||
req,
|
||||
None,
|
||||
uid,
|
||||
guid,
|
||||
cookie,
|
||||
timeout=timeout,
|
||||
)
|
||||
return self._raw_from_wup(resp) if isinstance(resp, WupResponse) else None
|
||||
|
||||
|
||||
def _self_check():
|
||||
uid = 1199647239697
|
||||
|
||||
Reference in New Issue
Block a user