feat(huya): 一键查询查不到角色标记 CK 失效并前端标红
外部导入的 CK 过期时,角色走的 webActUI.checkUserBindGameAccount 整包没有 tRsp 回包(真机日志 newdata keys: ['']),而积分中心通道仍能返回 200,于是页面显示绿色「成功」+「角色信息接口无响应」,看不出 CK 已经挂了。 - 后端 _execute_query_all:bind_status is None 时打 result.ck_expired / ck_expired_reason、account.status=ck_expired,message 追加「疑似 CK 已失效,请重新登录或重新导入 Cookie」;业务码非 200(活动已下线等)不算 CK 失效,避免整批误标红 - 前端 HuyaElitePage:状态列红色「CK 失效」(tooltip 带原因)、最近操作消息红色、游戏名空值红色「角色未查到」;HuyaTasksPage 账号状态映射补 ck_expired - 测试:角色接口无回包 → ck_expired + account.status;业务码非 200 不误标
This commit is contained in:
@@ -10,6 +10,13 @@
|
||||
* 开通时间 —— ``revenueWebUI.queryUserOrderList`` 里已支付的宝典订单,取最近一次支付时间。
|
||||
* 有效期 —— 商城订单(orderDetailV5)与积分中心都**不返回**到期时间,所以留空,
|
||||
界面上「有就显示」。
|
||||
* CK 失效 —— 「一键查询」里角色走活动通道(``webActUI.checkUserBindGameAccount``),
|
||||
真机(2026-10-15,外部导入的过期 CK)表现为**整个请求没有 tRsp 回包**
|
||||
(日志里 ``响应 newdata keys: ['']``),于是 ``_resolve_bind_status`` 返回 None。
|
||||
这种情况按「CK 已失效」处理:任务 result 打 ``ck_expired`` 标记、账号状态置
|
||||
``ck_expired``,前端把该行标红提示重新登录/重新导入 Cookie。
|
||||
积分中心走另一条通道(baseinfo 里的 cookie 校验更松),过期 CK 仍可能返回 200,
|
||||
所以不能拿积分能不能查来判 CK 有效性。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -335,6 +342,9 @@ class EliteMixin:
|
||||
self.payload.get("bind_act_id") or config_info.get("bind_act_id")
|
||||
)
|
||||
role_name = ""
|
||||
# 角色查不到 = 这个 CK 已经不认了(模块头里有真机依据),整行要标红提醒
|
||||
ck_expired = False
|
||||
ck_expired_reason = ""
|
||||
if not b_act_id_int:
|
||||
failures.append("未配置绑定 bActId")
|
||||
else:
|
||||
@@ -346,7 +356,9 @@ class EliteMixin:
|
||||
b_act_id_int=b_act_id_int,
|
||||
)
|
||||
if bind_status is None:
|
||||
failures.append("角色信息接口无响应")
|
||||
ck_expired = True
|
||||
ck_expired_reason = "角色信息接口无响应"
|
||||
failures.append(ck_expired_reason)
|
||||
elif bind_status.status != 200:
|
||||
failures.append(
|
||||
bind_status.msg or f"角色信息查询失败: {bind_status.status}"
|
||||
@@ -372,9 +384,14 @@ class EliteMixin:
|
||||
message_parts.append("未绑定角色")
|
||||
|
||||
account.points = points if points is not None else account.points
|
||||
account.status = "all_queried"
|
||||
# CK 失效时账号状态单独标出来(前端「状态」列据此显示红色「CK 失效」)
|
||||
account.status = "ck_expired" if ck_expired else "all_queried"
|
||||
account.updated_at = datetime.now(UTC)
|
||||
result["failures"] = failures
|
||||
if ck_expired:
|
||||
result["ck_expired"] = True
|
||||
result["ck_expired_reason"] = ck_expired_reason
|
||||
ck_hint = ";疑似 CK 已失效,请重新登录或重新导入 Cookie" if ck_expired else ""
|
||||
|
||||
fetched_anything = points is not None or role_name or opened is not None
|
||||
if not fetched_anything:
|
||||
@@ -382,7 +399,7 @@ class EliteMixin:
|
||||
worker_db,
|
||||
task,
|
||||
"failed",
|
||||
";".join(failures) or "一键查询全部失败",
|
||||
(";".join(failures) or "一键查询全部失败") + ck_hint,
|
||||
result,
|
||||
)
|
||||
return
|
||||
@@ -390,4 +407,4 @@ class EliteMixin:
|
||||
message = "|".join(message_parts) or "一键查询完成"
|
||||
if failures:
|
||||
message += f";部分失败: {';'.join(failures)}"
|
||||
self._mark_task(worker_db, task, "success", message, result)
|
||||
self._mark_task(worker_db, task, "success", message + ck_hint, result)
|
||||
|
||||
Reference in New Issue
Block a user