feat(weibo): 增加账号分配与客服数据隔离
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user