redesign/bug fixes/admin trial

This commit is contained in:
Vladless
2024-11-13 03:59:34 +03:00
parent 0c65d378cd
commit 13efb0cc45
15 changed files with 232 additions and 120 deletions
+15 -1
View File
@@ -1,5 +1,5 @@
from datetime import datetime
from loguru import logger
import asyncpg
from config import DATABASE_URL
@@ -74,6 +74,20 @@ async def init_db():
await conn.close()
async def restore_trial(tg_id: int):
conn = await asyncpg.connect(DATABASE_URL)
try:
await conn.execute(
"UPDATE connections SET trial = 0 WHERE tg_id = $1", tg_id
)
except Exception as e:
logger.error(f"Ошибка при установке значения триала: {e}")
finally:
await conn.close()
async def add_connection(tg_id: int, balance: float = 0.0, trial: int = 0):
conn = await asyncpg.connect(DATABASE_URL)