feat(weibo): 增加账号分配与客服数据隔离

This commit is contained in:
yml2213
2026-11-08 18:30:51 +08:00
parent c8b62e5267
commit 6b2285913f
16 changed files with 1320 additions and 55 deletions
+13
View File
@@ -63,6 +63,7 @@ def import_weibo_cookies(
activity: str = "",
update_existing: bool = False,
current_user_id: int | None = None,
can_update_all: bool = False,
) -> tuple[list[WeiboAccount], list[WeiboImportIssue], int]:
"""逐行验证并导入微博 CK。
@@ -98,6 +99,18 @@ def import_weibo_cookies(
db.query(WeiboAccount).filter(WeiboAccount.uid == snapshot.uid).first()
)
if account is not None and update_existing and current_user_id is not None:
if (
not can_update_all
and account.assigned_to is not None
and account.assigned_to != current_user_id
):
errors.append(
WeiboImportIssue(
line=line_no,
message="该账号已分配给其他客服,不能更新 CK",
)
)
continue
owner_id = (
db.query(WeiboWorkbenchAccount.user_id)
.filter(WeiboWorkbenchAccount.account_id == account.id)