完成虎牙宝典WSS绑定与快照隔离重构

This commit is contained in:
yml2213
2026-09-01 12:40:22 +08:00
parent 24f312a3a9
commit 26514b332d
11 changed files with 181 additions and 24 deletions
+10 -8
View File
@@ -1823,8 +1823,11 @@ def list_goods(
current: User = Depends(require_permission("huya:task")),
):
"""查看已缓存的虎牙商品快照。"""
rows = db.query(HuyaGoodsSnapshot).order_by(HuyaGoodsSnapshot.id.asc()).all()
return rows
rows = db.query(HuyaGoodsSnapshot).order_by(HuyaGoodsSnapshot.id.desc()).all()
latest = {}
for row in rows:
latest.setdefault((row.sid, row.product_id), row)
return list(latest.values())
@router.get("/recharge-goods", response_model=list[HuyaRechargeGoodsOut])
@@ -1833,12 +1836,11 @@ def list_recharge_goods(
current: User = Depends(require_permission("huya:task")),
):
"""查看已缓存的虎牙充值商品快照。"""
rows = (
db.query(HuyaRechargeGoodsSnapshot)
.order_by(HuyaRechargeGoodsSnapshot.id.asc())
.all()
)
return rows
rows = db.query(HuyaRechargeGoodsSnapshot).order_by(HuyaRechargeGoodsSnapshot.id.desc()).all()
latest = {}
for row in rows:
latest.setdefault((row.sid, row.spu_id), row)
return list(latest.values())
@router.post("/tasks/batch")