feat(douyu): 支持工作台分页与一键导入

This commit is contained in:
yml2213
2026-08-07 23:06:08 +08:00
parent 5d8fdf8620
commit c77e8f4641
3 changed files with 128 additions and 38 deletions
+31
View File
@@ -211,6 +211,37 @@ def list_task_accounts(
return result
@router.get("/accounts/ids")
def list_task_account_ids(
search: str = Query(""),
tag: str = Query(""),
db: Session = Depends(get_db),
current: User = Depends(get_current_user),
):
"""返回当前用户可导入工作台的全部账号 ID,不受列表分页限制。"""
query = _visible_task_accounts_query(db, current)
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}%"
query = query.filter(or_(
Account.username.ilike(pattern),
Account.uid.ilike(pattern),
Account.nickname.ilike(pattern),
Account.tag.ilike(pattern),
Account.game_name.ilike(pattern),
Account.esports_game_name.ilike(pattern),
Account.xpd_game_name.ilike(pattern),
))
account_ids = [
account_id
for account_id, in query.enable_eagerloads(False).order_by(Account.id.desc()).with_entities(Account.id).all()
]
return {"account_ids": account_ids, "total": len(account_ids)}
@router.get("/config", response_model=DouyuConfigOut)
def get_config(
db: Session = Depends(get_db),