修复(履约绑定): 匹配客户目标时展示 cjm 待确认角色

This commit is contained in:
yml
2026-11-26 01:40:49 +08:00
parent 473d9c7ecf
commit d62d56d98d
4 changed files with 99 additions and 21 deletions
+8 -2
View File
@@ -559,16 +559,22 @@ def pending_binding_role_from_result(result: dict[str, Any] | None) -> str:
in action_alias_set
and str(item.get("role_name") or "").strip()
]
expected_role_name = str(result.get("expected_role_name") or "").strip()
expected_matches = bool(
expected_role_name
and role_name.casefold() == expected_role_name.casefold()
)
if (
action_alias_set
and selected_alias
and selected_alias not in action_alias_set
and action_evidence
and not expected_matches
):
# legacy(cjm) 可能返回同一斗鱼账号历史绑过的另一个游戏角色。
# 动作 alias 仍有明确角色时,legacy 的 role_name 不能成为本单 pending。
# 动作 alias 仍有明确角色时,只有与客户目标一致的 legacy 角色可以进入
# pending;不匹配的历史角色不能覆盖本单。
return ""
expected_role_name = str(result.get("expected_role_name") or "").strip()
if is_pending_binding_role(
result,
baseline_role_name=baseline,
+26 -3
View File
@@ -382,7 +382,16 @@ class BindMixin:
for info, decision in zip(candidates, decisions, strict=True):
alias = str(info.get("act_alias") or "").strip()
role_name = str(info.get("role_name") or "").strip()
if alias not in alias_set and role_name not in action_roles:
expected_matches = bool(
expected_role_name
and role_name.casefold()
== expected_role_name.strip().casefold()
)
if (
alias not in alias_set
and role_name not in action_roles
and not expected_matches
):
decision.update(
{
"confirmable": False,
@@ -714,7 +723,14 @@ class BindMixin:
if not role_name or role_name.casefold() == baseline:
continue
alias = str(info.get("act_alias") or "").strip()
if action_alias_has_role and alias not in alias_set:
expected_matches = bool(
expected and role_name.casefold() == expected
)
if (
action_alias_has_role
and alias not in alias_set
and not expected_matches
):
continue
if expected and role_name.casefold() != expected:
continue
@@ -730,7 +746,14 @@ class BindMixin:
for info in ordered:
role_name = str(info.get("role_name") or "").strip()
alias = str(info.get("act_alias") or "").strip()
if action_alias_has_role and alias not in alias_set:
expected_matches = bool(
expected and role_name.casefold() == expected
)
if (
action_alias_has_role
and alias not in alias_set
and not expected_matches
):
continue
if expected and role_name.casefold() != expected:
continue