From 03932ca3342f17da6f178ff9d3371794aaacad22 Mon Sep 17 00:00:00 2001 From: pilot <657434@03b.ru> Date: Sun, 31 May 2026 15:07:14 +0800 Subject: [PATCH] =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D1=82=D0=B0=D1=82=D0=B8=D1=87?= =?UTF-8?q?=D0=B5=D1=81=D0=BA=D0=BE=D0=B3=D0=BE=20=D0=BF=D1=83=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- restoran_max_bot/max_bot/max_api.py | 4 +++- restoran_max_bot/max_bot/views.py | 5 +++-- restoran_max_bot/restoran_max_bot/bot_message.py | 3 ++- restoran_max_bot/restoran_max_bot/iiko_api.py | 1 - 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/restoran_max_bot/max_bot/max_api.py b/restoran_max_bot/max_bot/max_api.py index 9f6de42..ad2adbf 100644 --- a/restoran_max_bot/max_bot/max_api.py +++ b/restoran_max_bot/max_bot/max_api.py @@ -3,6 +3,7 @@ import json import requests from max_bot.models import Client from restoran_max_bot.common import common_get_menu, common_get_data +from restoran_max_bot.settings import DEBUG def maxbot_send_text_message(chat_id: str, max_token: str, message: str): @@ -67,7 +68,8 @@ def maxbot_send_menu_button(client: Client, chat_id: str, max_token: str, messag cnt = cnt + 1 buttons.append(button) - print(buttons) + if DEBUG: + print(buttons) payload = json.dumps({ "text": message, "attachments": [ diff --git a/restoran_max_bot/max_bot/views.py b/restoran_max_bot/max_bot/views.py index ab5e352..ea6cf6b 100644 --- a/restoran_max_bot/max_bot/views.py +++ b/restoran_max_bot/max_bot/views.py @@ -10,6 +10,7 @@ from restoran_max_bot.bot_started import bot_started from restoran_max_bot.bot_stopped import bot_stopped from restoran_max_bot.bot_message import bot_message from restoran_max_bot.common import common_get_contact +from restoran_max_bot.settings import DEBUG from restoran_max_bot.utils import is_json, has_key @@ -66,7 +67,8 @@ def api_start_max_v1(request, token, **kwargs): client = kwargs['client'] settings_max = kwargs['settings_max'] - print(data) + if DEBUG: + print(data) if not has_key(data, 'update_type'): rt = {'success': False, 'error': 'data update_type not found', 'data': ''} @@ -117,7 +119,6 @@ def iiko_webhook(request: WSGIRequest, token): @csrf_exempt def iiko_send_message(request: WSGIRequest, token): rt = {'success': False, 'data': ''} - # print(request.body) if request.method == "POST": data = json.loads(request.body) client = Client.objects.filter(token=token).first() diff --git a/restoran_max_bot/restoran_max_bot/bot_message.py b/restoran_max_bot/restoran_max_bot/bot_message.py index 1df8440..aca0562 100644 --- a/restoran_max_bot/restoran_max_bot/bot_message.py +++ b/restoran_max_bot/restoran_max_bot/bot_message.py @@ -5,6 +5,7 @@ from restoran_max_bot.bot_started import check_registration from restoran_max_bot.common import * from restoran_max_bot.iiko_api import customer_info, customer_create, customer_wallet from restoran_max_bot.rkiper_api import rkiper_customer_info, rkiper_customer_create +from restoran_max_bot.settings import STATICFILES_DIRS from restoran_max_bot.utils import has_key @@ -100,7 +101,7 @@ def bot_message(client: Client, message: dict, settings: dict, message_type): for dt in data: if dt.title == '##bonus##': img = qrcode.make(contact.phone) - img.save(f"./restoran_max_bot/static/client_qr/{contact.phone}.png") + img.save(f"{STATICFILES_DIRS[0]}/client_qr/{contact.phone}.png") url = f"https://maxbot.telefon-ip.ru/static/client_qr/{contact.phone}.png" maxbot_send_img_message(chat_id=chat_id, max_token=settings['token'], img=url, message='QR-код для начисления, списания бонусов.') diff --git a/restoran_max_bot/restoran_max_bot/iiko_api.py b/restoran_max_bot/restoran_max_bot/iiko_api.py index ddc2476..65329c5 100644 --- a/restoran_max_bot/restoran_max_bot/iiko_api.py +++ b/restoran_max_bot/restoran_max_bot/iiko_api.py @@ -55,7 +55,6 @@ def customer_create(api_key, phone, name, organization_id, birthday: str): 'Authorization': 'Bearer ' + access_token(api_key) } response = requests.request("POST", url, headers=headers, data=payload) - print(response.text) if response.status_code == 200: data = response.json() else: