redesign/bug fixes/admin trial

This commit is contained in:
Vladless
2024-11-13 04:01:13 +03:00
parent c01c888f0e
commit 38f02bbcb6
12 changed files with 73 additions and 56 deletions
+4 -6
View File
@@ -1,6 +1,7 @@
from datetime import datetime
from loguru import logger
import asyncpg
from loguru import logger
from config import DATABASE_URL
@@ -74,12 +75,11 @@ 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
)
await conn.execute("UPDATE connections SET trial = 0 WHERE tg_id = $1", tg_id)
except Exception as e:
logger.error(f"Ошибка при установке значения триала: {e}")
@@ -87,8 +87,6 @@ async def restore_trial(tg_id: int):
await conn.close()
async def add_connection(tg_id: int, balance: float = 0.0, trial: int = 0):
conn = await asyncpg.connect(DATABASE_URL)
await conn.execute(