Update app.py
Browse files
app.py
CHANGED
@@ -791,7 +791,7 @@ curator_on_off = "1" # Глобальная переменная для упр
|
|
791 |
|
792 |
current_curator_index = 0
|
793 |
|
794 |
-
def
|
795 |
if verifikation_start == "1":
|
796 |
# Здесь должен быть ваш код для верификации номера телефона
|
797 |
# Например, вызов внешнего API для проверки наличия WhatsApp
|
@@ -799,7 +799,7 @@ def verify_phone_number(phone_number):
|
|
799 |
else:
|
800 |
return "false"
|
801 |
|
802 |
-
def
|
803 |
conn = sqlite3.connect(db_name)
|
804 |
cursor = conn.cursor()
|
805 |
|
@@ -867,7 +867,7 @@ def update_or_insert_user(db_name, user_data, mapping_template):
|
|
867 |
|
868 |
# Верификация номера телефона
|
869 |
if 'phone' in user_data and verifikation_start == "1":
|
870 |
-
phone_verification_result =
|
871 |
if phone_verification_result == "true":
|
872 |
transformed_data['ws_st'] = "True"
|
873 |
else:
|
@@ -902,7 +902,7 @@ def update_or_insert_user(db_name, user_data, mapping_template):
|
|
902 |
logging.debug(f"User with email {email} processed successfully")
|
903 |
|
904 |
@app.route('/send_get_request', methods=['GET'])
|
905 |
-
def
|
906 |
token = request.args.get('token')
|
907 |
webinarId = request.args.get('webinarId')
|
908 |
url = f'https://online.bizon365.ru/api/v1/webinars/reports/get?webinarId={webinarId}'
|
@@ -941,7 +941,7 @@ def send_get_request():
|
|
941 |
user_data['messages'] = user_messages
|
942 |
email = user_data.get('email')
|
943 |
if email and email not in processed_emails:
|
944 |
-
|
945 |
processed_emails.add(email)
|
946 |
|
947 |
return jsonify({'status': 'User data saved successfully'})
|
@@ -950,7 +950,7 @@ def send_get_request():
|
|
950 |
return jsonify({'error': f'API request failed: {str(e)}'}), 500
|
951 |
|
952 |
@app.route('/webhookbz', methods=['POST'])
|
953 |
-
def
|
954 |
api_sys_control = request.args.get('api_sys')
|
955 |
if api_sys_control != api_key_sys:
|
956 |
return "EUR 22", 200
|
@@ -990,7 +990,7 @@ def webhookbz():
|
|
990 |
user_data['messages'] = user_messages
|
991 |
email = user_data.get('email')
|
992 |
if email and email not in processed_emails:
|
993 |
-
|
994 |
processed_emails.add(email)
|
995 |
|
996 |
return jsonify({'status': 'User data saved successfully'})
|
@@ -1014,7 +1014,6 @@ def webhookbz():
|
|
1014 |
|
1015 |
|
1016 |
|
1017 |
-
|
1018 |
@app.route('/biz_v', methods=['GET'])
|
1019 |
def biz_v():
|
1020 |
api_sys_control = request.args.get('api_sys')
|
|
|
791 |
|
792 |
current_curator_index = 0
|
793 |
|
794 |
+
def verify_phone_number_biz(phone_number):
|
795 |
if verifikation_start == "1":
|
796 |
# Здесь должен быть ваш код для верификации номера телефона
|
797 |
# Например, вызов внешнего API для проверки наличия WhatsApp
|
|
|
799 |
else:
|
800 |
return "false"
|
801 |
|
802 |
+
def update_or_insert_user_biz(db_name, user_data, mapping_template):
|
803 |
conn = sqlite3.connect(db_name)
|
804 |
cursor = conn.cursor()
|
805 |
|
|
|
867 |
|
868 |
# Верификация номера телефона
|
869 |
if 'phone' in user_data and verifikation_start == "1":
|
870 |
+
phone_verification_result = verify_phone_number_biz(transformed_data['phone'])
|
871 |
if phone_verification_result == "true":
|
872 |
transformed_data['ws_st'] = "True"
|
873 |
else:
|
|
|
902 |
logging.debug(f"User with email {email} processed successfully")
|
903 |
|
904 |
@app.route('/send_get_request', methods=['GET'])
|
905 |
+
def send_get_request_biz():
|
906 |
token = request.args.get('token')
|
907 |
webinarId = request.args.get('webinarId')
|
908 |
url = f'https://online.bizon365.ru/api/v1/webinars/reports/get?webinarId={webinarId}'
|
|
|
941 |
user_data['messages'] = user_messages
|
942 |
email = user_data.get('email')
|
943 |
if email and email not in processed_emails:
|
944 |
+
update_or_insert_user_biz(DATABASE_NAME, user_data, mapping_template)
|
945 |
processed_emails.add(email)
|
946 |
|
947 |
return jsonify({'status': 'User data saved successfully'})
|
|
|
950 |
return jsonify({'error': f'API request failed: {str(e)}'}), 500
|
951 |
|
952 |
@app.route('/webhookbz', methods=['POST'])
|
953 |
+
def webhookbz_biz():
|
954 |
api_sys_control = request.args.get('api_sys')
|
955 |
if api_sys_control != api_key_sys:
|
956 |
return "EUR 22", 200
|
|
|
990 |
user_data['messages'] = user_messages
|
991 |
email = user_data.get('email')
|
992 |
if email and email not in processed_emails:
|
993 |
+
update_or_insert_user_biz(DATABASE_NAME, user_data, mapping_template)
|
994 |
processed_emails.add(email)
|
995 |
|
996 |
return jsonify({'status': 'User data saved successfully'})
|
|
|
1014 |
|
1015 |
|
1016 |
|
|
|
1017 |
@app.route('/biz_v', methods=['GET'])
|
1018 |
def biz_v():
|
1019 |
api_sys_control = request.args.get('api_sys')
|