feat(huya): 协作台账支持皮肤筛选与主页截图拖拽/粘贴上传

- 外部单列表新增礼包/皮肤精确筛选,并提供去重下拉选项
- 主页截图支持拖拽、多选及 Ctrl/Cmd+V 剪贴板粘贴上传
This commit is contained in:
yml2213
2026-10-17 12:49:42 +08:00
parent 1dd5c4a279
commit 26b8d6b054
8 changed files with 173 additions and 29 deletions
+11
View File
@@ -113,6 +113,15 @@ def external_orders_shops(
return collab.list_shops(db)
@router.get("/external-orders/gifts", response_model=list[str])
def external_orders_gifts(
db: Session = Depends(get_db),
_current: User = Depends(require_permission("huya:collab:view")),
):
"""已用过的礼包/皮肤名(去重;筛选下拉用)。"""
return collab.list_gift_names(db)
# --------------------------------------------------------------------------
# 店铺字典(新建协作单时点选;也支持自定义输入后自动登记)
# --------------------------------------------------------------------------
@@ -190,6 +199,7 @@ def list_external_orders(
owner_id: int | None = Query(None),
status: str = Query("", max_length=16),
ck_status: str = Query("", max_length=16),
gift_name: str = Query("", max_length=128),
keyword: str = Query("", max_length=128),
include_void: bool = Query(False, description="是否包含已作废的行(默认隐藏)"),
page: int = Query(1, ge=1),
@@ -204,6 +214,7 @@ def list_external_orders(
owner_id=owner_id,
status=status,
ck_status=ck_status,
gift_name=gift_name,
keyword=keyword,
include_void=include_void,
page=page,
@@ -2019,6 +2019,14 @@ def list_shops(db: Session) -> list[str]:
return sorted(shop.name for shop in list_shop_records(db))
def list_gift_names(db: Session) -> list[str]:
"""台账里出现过的礼包/皮肤名(去重、去空;筛选下拉用)。"""
rows = db.query(HuyaExternalOrder.gift_name).distinct().all()
return sorted(
{str(row[0]).strip() for row in rows if row[0] and str(row[0]).strip()}
)
# --------------------------------------------------------------------------
# CRUD
# --------------------------------------------------------------------------
@@ -2262,6 +2270,7 @@ def list_orders(
owner_id: int | None = None,
status: str = "",
ck_status: str = "",
gift_name: str = "",
keyword: str = "",
include_void: bool = False,
page: int = 1,
@@ -2277,6 +2286,9 @@ def list_orders(
query = query.filter(HuyaExternalOrder.status == status)
if ck_status:
query = query.filter(HuyaExternalOrder.ck_status == ck_status)
skin = (gift_name or "").strip()
if skin:
query = query.filter(HuyaExternalOrder.gift_name == skin)
if not include_void:
query = query.filter(HuyaExternalOrder.status != STATUS_VOID)
text = (keyword or "").strip()