fix(douyu): 升级工作台任务流并修正换绑冷却

This commit is contained in:
yml
2026-11-22 23:39:02 +08:00
parent 4b57f9b2a7
commit 8e01c3c69e
9 changed files with 343 additions and 113 deletions
+10 -2
View File
@@ -532,12 +532,20 @@ def binding_snapshot(info: dict | None) -> dict[str, Any]:
data = info if isinstance(info, dict) else {}
role_name = _binding_role_name(data)
bound_status = derive_from_bind_info(data)
confirmed = bound_status == BIND_BOUND
phase = {
BIND_BOUND: "confirmed",
BIND_PENDING: "role_ready",
BIND_UNBOUND: "unbound",
}.get(bound_status or "", "unknown")
bound_act = _explicit_flag(data.get("is_bound_act")) is True
# 腾讯接口在未完成 bindAct 时会返回 changeRoleWaitTime=2592000 的占位值。
# 这不是冷却;未确认绑定必须归一为没有倒计时,原始值仍保留在 bind_info 供排查。
change_role_wait_time = _to_int(data.get("change_role_wait_time"))
can_change_time = _to_int(data.get("can_change_time"))
if not confirmed:
change_role_wait_time = 0
can_change_time = None
return {
"role_name": role_name,
"area_name": str(data.get("area_name") or "").strip(),
@@ -552,8 +560,8 @@ def binding_snapshot(info: dict | None) -> dict[str, Any]:
"is_bound_act": bound_act,
"need_bind_act": _truthy_flag(data.get("need_bind_act")),
"need_bind_role": _truthy_flag(data.get("need_bind_role")),
"change_role_wait_time": _to_int(data.get("change_role_wait_time")),
"can_change_time": _to_int(data.get("can_change_time")),
"change_role_wait_time": change_role_wait_time,
"can_change_time": can_change_time,
"can_change_role": can_change_role(data),
"is_change_cooling": is_role_change_cooling(data),
"bind_status": bound_status,
+3 -13
View File
@@ -2166,20 +2166,10 @@ class BindMixin:
f"查询换绑时间候选 act={item.get('act_alias') or '-'} "
f"{self._format_bind_summary(item)}",
)
# 换绑时间看“当前已绑定”活动态,不要优先 cjm(cjm 常无 changeRoleWaitTime)
action_aliases = self._action_act_aliases(config)
bind_info = next(
(
item
for alias in action_aliases
for item in raw_candidates
if str(item.get("act_alias") or "") == alias
and item.get("change_role_wait_time") is not None
),
None,
)
# 与其他绑定流程共用“当前已绑定优先”的候选选择。
# cjm 常没有 changeRoleWaitTime,不能靠原始字段是否存在来决定业务口径。
bind_info = (
bind_info
self._pick_change_wait_bind_info(raw_candidates, config)
or (
role.get("bind_info")
if isinstance(role.get("bind_info"), dict)