feat(huya): 统一积分兑换并完善兑换记录

This commit is contained in:
yml
2026-11-13 19:03:55 +08:00
parent b89ee4fd18
commit 711be0e2b6
17 changed files with 2064 additions and 193 deletions
+65 -1
View File
@@ -14,7 +14,7 @@ from core.huya.http_client import (
_extract_ws_hosts,
generate_ws_baseinfo,
)
from core.huya.shop_structs import shop_spu_number
from core.huya.shop_structs import extract_points_center_sid, shop_spu_number
from core.huya.taf_protocol import TafInputStream, TafOutputStream, TafType
from core.huya.wss_client import (
HuyaWssClient,
@@ -218,6 +218,70 @@ def test_create_order_v5_matches_points_capture():
asyncio.run(run())
def test_create_order_v6_matches_points_exchange_capture():
async def run():
client = _points_client()
await client.create_order_v6(
uid=UID,
guid=GUID,
cookie=COOKIE,
pid=PID,
items=[
{
"spu_id": "hy-8315982",
"sku_id": 7747527,
"item_count": 1,
}
],
)
message = WssMessage.decode(client.ws.sent[-1])
assert message.command == WssCommand.RPC_REQUEST
decoded = _decode_wup_body(message.body)
assert (decoded["servant"], decoded["func"]) == (
"shopMiddleUI",
"createOrderV6",
)
t_req = decoded["tReq"]
assert t_req["tag3"] == [
{
"tag0": "hy-8315982",
"tag1": 7747527,
"tag2": 1,
"tag3": [],
"tag4": 0,
"tag5": 0,
}
]
assert t_req["tag4"] == PID
assert t_req["tag6"] == "0"
assert t_req["tag8"] == 2
assert t_req["tag10"] == 6
assert t_req["tag11"]["tag4"] == BIZ_PARAMS_LITERAL
assert t_req["tag14"] == "yellowcarlist"
assert t_req["tag16"] == 3
asyncio.run(run())
def test_current_points_center_payload_exposes_exchange_sid():
payload = {
"tag2": [
{
"tag2_2": {
"tag0": {
"tag1": "精英宝典福利季",
"tag7": 2277,
}
}
}
]
}
assert extract_points_center_sid(payload) == 2277
def test_pay_order_submit_v5_callback_points_page():
async def run():
client = _points_client()