完成虎牙宝典WSS绑定与快照隔离重构
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user