fix(douyu): 支持同名角色重新绑定
This commit is contained in:
@@ -295,10 +295,9 @@ def binding_pending_decision(
|
||||
) -> dict[str, Any]:
|
||||
"""解释一个绑定候选是否可进入确认阶段。
|
||||
|
||||
角色名不是唯一事实:用户可能换绑到同名角色。判断还要对比扫码前后的
|
||||
活动绑定状态,尤其是活动 alias 从 ``bindAct=1`` 转为
|
||||
``bindAct=0 + needBindAct=1`` 的待确认转换。活动 alias 上已经存在的
|
||||
同名 pending 也不是“旧角色残留”,它仍然可以调用确认接口。
|
||||
角色名不是唯一事实,也不能要求每次都必须换新角色。用户重新绑定同名角色
|
||||
时,判断还要对比扫码前后的活动绑定状态。活动 alias 只要仍要求
|
||||
``needBindAct=1``,即使当前 ``bindAct=1``,同名角色也可以进入确认流程。
|
||||
"""
|
||||
result: dict[str, Any] = {
|
||||
"alias": str((info or {}).get("act_alias") or ""),
|
||||
@@ -354,10 +353,10 @@ def binding_pending_decision(
|
||||
if role_name.casefold() != baseline.casefold():
|
||||
result.update({"confirmable": True, "reason": "role_changed"})
|
||||
return result
|
||||
if snapshot["is_bound_act"]:
|
||||
result["reason"] = "already_bound"
|
||||
return result
|
||||
if not isinstance(baseline_info, dict):
|
||||
if snapshot["is_bound_act"]:
|
||||
result["reason"] = "already_bound"
|
||||
return result
|
||||
result["reason"] = "same_role_without_baseline_info"
|
||||
return result
|
||||
|
||||
@@ -387,6 +386,9 @@ def binding_pending_decision(
|
||||
}
|
||||
)
|
||||
return result
|
||||
if snapshot["is_bound_act"]:
|
||||
result["reason"] = "already_bound"
|
||||
return result
|
||||
result["reason"] = "same_role_stale"
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user