修复(履约与分配): 封堵工作台换绑、预售共号与分配中心越权占用

This commit is contained in:
yml
2026-11-27 13:42:28 +08:00
parent 9100991cb1
commit 5006367217
13 changed files with 1031 additions and 34 deletions
+37
View File
@@ -30,6 +30,7 @@ from .account_binding import (
role_change_available_at,
set_bind_status,
)
from .binding_ownership import role_names_match, workbench_task_occupation_error
from .business_events import record_bind
from .douyu_account_probe import (
ROLE_BOUND,
@@ -1340,6 +1341,20 @@ class BindMixin:
"bind_candidate_decisions": candidate_decisions,
}
)
if (
snapshot["role_name"]
and not role_names_match(baseline_role_name, snapshot["role_name"])
):
record_bind(
db,
account,
task_id=task.id,
scope="elite",
role_name=snapshot["role_name"],
act_alias=query_alias,
rebind=bool(str(baseline_role_name or "").strip()),
actor_id=int(task.created_by),
)
self._apply_bind_info_to_account(account, bind_info, BIND_BOUND)
self._mark_task(
db,
@@ -1488,6 +1503,17 @@ class BindMixin:
def _execute_get_bind_qr(
self, db: Session, task: DouyuTask, account: Account, cookie: str, config: dict
):
occupation_error = workbench_task_occupation_error(
db,
account,
task_type="get_bind_qr",
handbook_scope=str(task.handbook_scope or ""),
platform_task_id=task.platform_task_id,
allow_auto_link=False,
)
if occupation_error:
self._mark_task(db, task, "failed", occupation_error)
return
client = self._client(cookie)
expected_role_name = str(
(task.result or {}).get("expected_role_name") or ""
@@ -1758,6 +1784,17 @@ class BindMixin:
def _execute_confirm_bind(
self, db: Session, task: DouyuTask, account: Account, cookie: str, config: dict
):
occupation_error = workbench_task_occupation_error(
db,
account,
task_type="confirm_bind",
handbook_scope=str(task.handbook_scope or ""),
platform_task_id=task.platform_task_id,
allow_auto_link=False,
)
if occupation_error:
self._mark_task(db, task, "failed", occupation_error)
return
client = self._client(cookie)
confirm_alias = self._confirm_act_alias(config)
query_aliases = self._query_bind_act_aliases(config)