RealtyCalendar plugin

This commit is contained in:
2024-12-24 15:43:43 +09:00
parent 77bf0b8381
commit d5622f41a2
58 changed files with 374 additions and 1714 deletions

View File

@@ -4,6 +4,9 @@ from hotels.models import Hotel, UserHotel
from users.models import User
from pms_integration.manager import PMSIntegrationManager
from bot.utils.froud_check import detect_fraud
from touchh.utils.log import CustomLogger
logger = CustomLogger(name="BOT-hotels Manager", log_level="DEBUG").get_logger()
async def manage_hotels(update: Update, context):
"""Отображение списка отелей, связанных с пользователем."""
query = update.callback_query
@@ -81,7 +84,8 @@ async def check_pms(update, context):
try:
# Получение ID отеля из callback_data
hotel_id = query.data.split("_")[2]
logger.debug(f"Hotel ID: {hotel_id}")
logger.debug(f"Hotel ID type : {type(hotel_id)}")
# Получение конфигурации отеля и PMS
hotel = await sync_to_async(Hotel.objects.select_related('pms').get)(id=hotel_id)
pms_config = hotel.pms
@@ -99,6 +103,7 @@ async def check_pms(update, context):
if hasattr(pms_manager.plugin, 'fetch_data') and callable(pms_manager.plugin.fetch_data):
# Плагин поддерживает метод fetch_data
report = await pms_manager.plugin._fetch_data()
else:
await query.edit_message_text("Подходящий способ интеграции с PMS не найден.")
return
@@ -110,6 +115,7 @@ async def check_pms(update, context):
f"Обработано записей: {report['processed_items']}\n"
f"Ошибки: {len(report['errors'])}"
)
logger.info(f'Result_Message: {result_message}\n Result_meaage_type: {type(result_message)}')
if report["errors"]:
result_message += "\n\nСписок ошибок:\n" + "\n".join(report["errors"])