delete websocket in coins(не работает нихуя)

This commit is contained in:
aurinex
2025-12-29 13:54:51 +05:00
parent 9d007a45c8
commit daa2561b89
6 changed files with 5 additions and 99 deletions

View File

@ -3,7 +3,6 @@ import re
from app.db.database import users_collection
from fastapi import HTTPException
from app.db.database import db
from app.realtime.coins_hub import coins_hub
MAX_MINUTES_PER_UPDATE = 120
@ -71,8 +70,6 @@ class CoinsService:
{"$set": {"coins": new_coins, "total_time_played": new_total_time}}
)
await coins_hub.send_update(user["username"], new_coins)
await coins_sessions_collection.insert_one({
"player_id": player_id,
"player_name": player_name,
@ -141,9 +138,7 @@ class CoinsService:
raise HTTPException(status_code=404, detail=f"Пользователь {username} не найден")
user = await users_collection.find_one({"username": username})
new_balance = user.get("coins", 0)
await coins_hub.send_update(username, new_balance)
return new_balance
return user.get("coins", 0)
async def decrease_balance(self, username: str, amount: int) -> int:
"""Уменьшить баланс пользователя"""
@ -159,6 +154,4 @@ class CoinsService:
raise HTTPException(status_code=404, detail=f"Пользователь {username} не найден")
user = await users_collection.find_one({"username": username})
new_balance = user.get("coins", 0)
await coins_hub.send_update(username, new_balance)
return new_balance
return user.get("coins", 0)