斗鱼客服导入账号 支持tag
This commit is contained in:
@@ -239,6 +239,7 @@ def task_types(current: User = Depends(require_permission("douyu:task"))):
|
||||
@router.get("/accounts")
|
||||
def list_task_accounts(
|
||||
search: str = Query(""),
|
||||
tag: str = Query(""),
|
||||
ids: str = Query(""),
|
||||
page: int | None = Query(None, ge=1),
|
||||
page_size: int = Query(50, ge=1, le=200),
|
||||
@@ -247,12 +248,15 @@ def list_task_accounts(
|
||||
):
|
||||
"""查看可执行斗鱼任务的账号(必须有成功 Cookie)。
|
||||
|
||||
ids 为逗号分隔的账号 ID,用于工作台按已导入账号过滤;为空时返回全部。
|
||||
tag 按账号标签精确筛选;ids 为逗号分隔的账号 ID,用于工作台按已导入账号过滤;为空时返回全部。
|
||||
"""
|
||||
query = _visible_task_accounts_query(db, current)
|
||||
id_list = [int(x) for x in ids.split(",") if x.strip().isdigit()]
|
||||
if id_list:
|
||||
query = query.filter(Account.id.in_(id_list))
|
||||
tag_text = (tag or "").strip()
|
||||
if tag_text:
|
||||
query = query.filter(Account.tag == tag_text)
|
||||
search_text = (search or "").strip()
|
||||
if search_text:
|
||||
pattern = f"%{search_text}%"
|
||||
|
||||
Reference in New Issue
Block a user