add extend keyboard hooks / refactor hot leads texts / fix hot leads notification logic
This commit is contained in:
@@ -5,7 +5,6 @@ from sqlalchemy.exc import SQLAlchemyError
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from database.models import Key, User
|
||||
from database.notifications import clear_hot_lead_notifications
|
||||
from logger import logger
|
||||
|
||||
|
||||
@@ -43,10 +42,6 @@ async def store_key(
|
||||
await session.commit()
|
||||
logger.info(f"✅ Ключ сохранён: tg_id={tg_id}, client_id={client_id}, server_id={server_id}")
|
||||
|
||||
try:
|
||||
await clear_hot_lead_notifications(session, tg_id)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
except SQLAlchemyError as e:
|
||||
logger.error(f"❌ Ошибка при сохранении ключа: {e}")
|
||||
|
||||
@@ -96,26 +96,6 @@ async def check_hot_lead_discount(session: AsyncSession, tg_id: int) -> dict:
|
||||
return {"available": False}
|
||||
|
||||
|
||||
async def clear_hot_lead_notifications(session: AsyncSession, tg_id: int):
|
||||
try:
|
||||
await session.execute(
|
||||
delete(Notification).where(
|
||||
Notification.tg_id == tg_id,
|
||||
Notification.notification_type.in_([
|
||||
"hot_lead_step_1",
|
||||
"hot_lead_step_2",
|
||||
"hot_lead_step_3",
|
||||
"hot_lead_step_2_expired",
|
||||
]),
|
||||
)
|
||||
)
|
||||
await session.commit()
|
||||
logger.info(f"✅ Уведомления о скидках горячих лидов очищены для пользователя {tg_id}")
|
||||
except SQLAlchemyError as e:
|
||||
logger.error(f"❌ Ошибка при очистке уведомлений о скидках для {tg_id}: {e}")
|
||||
await session.rollback()
|
||||
|
||||
|
||||
async def check_notifications_bulk(
|
||||
session: AsyncSession,
|
||||
notification_type: str,
|
||||
|
||||
Reference in New Issue
Block a user