修复(账号选号): 已分配账号不再进入自动选号池
自动选号只允许未归属账号;已分配给客服、运营或管理员的账号必须先释放归属,才能重新参与自动选号。
This commit is contained in:
@@ -15,7 +15,6 @@ from ..models import (
|
||||
DouyuExternalOrder,
|
||||
LoginAttempt,
|
||||
LoginTask,
|
||||
User,
|
||||
)
|
||||
from .account_capability_service import (
|
||||
ACCOUNT_ELIGIBILITY_ELIGIBLE,
|
||||
@@ -33,7 +32,6 @@ ACTIVE_COLLAB_STATUSES: tuple[str, ...] = (
|
||||
"role_error",
|
||||
"failed",
|
||||
)
|
||||
POOL_OWNER_ROLES: tuple[str, ...] = ("super_admin", "operation", "support")
|
||||
CK_FRESH_SECONDS = 24 * 60 * 60
|
||||
LOGIN_ATTEMPT_IN_FLIGHT_STATUSES = ("pending", "running")
|
||||
BUSINESS_TZ = ZoneInfo("Asia/Shanghai")
|
||||
@@ -63,13 +61,6 @@ def in_flight_login_exists():
|
||||
)
|
||||
|
||||
|
||||
def pool_owner_ids():
|
||||
return select(User.id).where(
|
||||
User.role.in_(POOL_OWNER_ROLES),
|
||||
User.is_active.is_(True),
|
||||
)
|
||||
|
||||
|
||||
def cookie_present_filter():
|
||||
return and_(Account.cookie.isnot(None), Account.cookie != "")
|
||||
|
||||
@@ -257,10 +248,8 @@ def relogin_eligible_account_filter(
|
||||
|
||||
|
||||
def assigned_to_pool_filter():
|
||||
return or_(
|
||||
Account.assigned_to.is_(None),
|
||||
Account.assigned_to.in_(pool_owner_ids()),
|
||||
)
|
||||
"""自动选号只使用未分配账号;已分配给客服/运营的账号必须先从归属上释放。"""
|
||||
return Account.assigned_to.is_(None)
|
||||
|
||||
|
||||
def active_lease_exists():
|
||||
@@ -339,7 +328,6 @@ __all__ = [
|
||||
"ACTIVE_COLLAB_STATUSES",
|
||||
"CK_FRESH_SECONDS",
|
||||
"LOGIN_ATTEMPT_IN_FLIGHT_STATUSES",
|
||||
"POOL_OWNER_ROLES",
|
||||
"active_collab_order_exists",
|
||||
"active_lease_exists",
|
||||
"assigned_to_pool_filter",
|
||||
@@ -350,7 +338,6 @@ __all__ = [
|
||||
"cookie_present_filter",
|
||||
"fresh_ck_cutoff",
|
||||
"fresh_eligible_state_filter",
|
||||
"pool_owner_ids",
|
||||
"recent_elite_bind_lock_exists",
|
||||
"relogin_failure_kind_filter",
|
||||
"role_change_ready_filter",
|
||||
|
||||
Reference in New Issue
Block a user