完成虎牙宝典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
+11 -2
View File
@@ -245,10 +245,15 @@ class GoodsMixin:
if item.get("product_id") and item.get("name")
]
now = datetime.now(UTC)
worker_db.query(HuyaGoodsSnapshot).delete(synchronize_session=False)
worker_db.query(HuyaGoodsSnapshot).filter(
HuyaGoodsSnapshot.account_id == account.id,
HuyaGoodsSnapshot.sid == sid_int,
).delete(synchronize_session=False)
for item in goods:
worker_db.add(
HuyaGoodsSnapshot(
account_id=account.id,
sid=sid_int,
product_id=item["product_id"],
name=item["name"],
price=item["price"],
@@ -298,7 +303,11 @@ class GoodsMixin:
snapshot = (
worker_db.query(HuyaGoodsSnapshot)
.filter(HuyaGoodsSnapshot.product_id == str(product_id))
.filter(
HuyaGoodsSnapshot.account_id == account.id,
HuyaGoodsSnapshot.sid == sid_int,
HuyaGoodsSnapshot.product_id == str(product_id),
)
.first()
)
product_name = str(