修复(履约绑定): 修复候选快照丢失与全链路绑定校验一致性
This commit is contained in:
@@ -19,6 +19,7 @@ from ..models import Account, DouyuTask
|
||||
from .account_binding import (
|
||||
binding_channel,
|
||||
get_bind_status,
|
||||
hydrate_bind_candidates_from_result,
|
||||
pending_binding_role_from_result,
|
||||
)
|
||||
|
||||
@@ -97,6 +98,30 @@ def resolve_douyu_binding(
|
||||
|
||||
pending_area = str(result.get("area_name") or "").strip() if pending_role else ""
|
||||
pending_plat = str(result.get("plat_name") or "").strip() if pending_role else ""
|
||||
if pending_role and (not pending_area or not pending_plat):
|
||||
action_aliases = {
|
||||
str(value or "").strip()
|
||||
for value in (result.get("action_act_aliases") or [])
|
||||
if str(value or "").strip()
|
||||
}
|
||||
matching_candidates = [
|
||||
item
|
||||
for item in hydrate_bind_candidates_from_result(result)
|
||||
if str(item.get("role_name") or "").strip().casefold()
|
||||
== pending_role.casefold()
|
||||
and (item.get("area_name") or item.get("plat_name"))
|
||||
]
|
||||
matching_candidates.sort(
|
||||
key=lambda item: (
|
||||
0
|
||||
if str(item.get("act_alias") or item.get("alias") or "").strip()
|
||||
in action_aliases
|
||||
else 1
|
||||
)
|
||||
)
|
||||
if matching_candidates:
|
||||
pending_area = pending_area or str(matching_candidates[0].get("area_name") or "").strip()
|
||||
pending_plat = pending_plat or str(matching_candidates[0].get("plat_name") or "").strip()
|
||||
pending_channel = binding_channel(
|
||||
{
|
||||
"area_name": pending_area,
|
||||
|
||||
Reference in New Issue
Block a user