redesign/bug fixes/admin trial
This commit is contained in:
+15
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user