test player_inventory
This commit is contained in:
@ -112,19 +112,28 @@ class MarketplaceService:
|
||||
}
|
||||
|
||||
async def confirm_operation(self, operation_id: str, status: str = "success", error: str = None):
|
||||
"""Подтвердить выполнение операции"""
|
||||
update = {
|
||||
"status": status
|
||||
}
|
||||
|
||||
update = {"status": status}
|
||||
if error:
|
||||
update["error"] = error
|
||||
|
||||
result = await marketplace_operations.update_one(
|
||||
{"id": operation_id},
|
||||
{"$set": update}
|
||||
)
|
||||
|
||||
|
||||
await marketplace_operations.update_one({"id": operation_id}, {"$set": update})
|
||||
|
||||
# ✅ ДОБАВИТЬ ЭТО:
|
||||
operation = await marketplace_operations.find_one({"id": operation_id})
|
||||
if operation and operation.get("type") == "case_reward" and operation.get("inventory_item_id"):
|
||||
inv_id = operation["inventory_item_id"]
|
||||
|
||||
if status in ("success", "completed", "done"):
|
||||
await db.player_inventory.update_one(
|
||||
{"id": inv_id},
|
||||
{"$set": {"status": "delivered", "delivered_at": datetime.utcnow()}}
|
||||
)
|
||||
elif status in ("failed", "error", "cancelled"):
|
||||
await db.player_inventory.update_one(
|
||||
{"id": inv_id},
|
||||
{"$set": {"status": "stored", "withdraw_operation_id": None}}
|
||||
)
|
||||
|
||||
return {"status": "success"}
|
||||
|
||||
async def update_item_details(self, operation_id: str, item_data: dict):
|
||||
|
||||
Reference in New Issue
Block a user