Update app.py
Browse files
app.py
CHANGED
|
@@ -849,8 +849,7 @@ def update_or_insert_user(db_name, user_data, mapping_template):
|
|
| 849 |
"vk_id", "chat_id", "ws_st", "ws_stop", "web_st", "fin_prog",
|
| 850 |
"b_city", "b_fin", "b_ban", "b_ign", "b_baners", "b_butt", "b_mess",
|
| 851 |
"shop_st", "curator", "pr1", "pr2", "pr3", "pr4", "pr5", "ad_url",
|
| 852 |
-
"key_pr", "n_con", "canal", "data_t", 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content'
|
| 853 |
-
"phone_verified" # Добавлено поле phone_verified
|
| 854 |
]
|
| 855 |
for field in required_fields:
|
| 856 |
if field not in transformed_data:
|
|
@@ -870,9 +869,9 @@ def update_or_insert_user(db_name, user_data, mapping_template):
|
|
| 870 |
if 'phone' in user_data and verifikation_start == "1":
|
| 871 |
phone_verification_result = verify_phone_number(transformed_data['phone'])
|
| 872 |
if phone_verification_result == "true":
|
| 873 |
-
transformed_data['
|
| 874 |
else:
|
| 875 |
-
transformed_data['
|
| 876 |
|
| 877 |
# Назначение куратора
|
| 878 |
if curator_on_off == "1":
|
|
@@ -902,23 +901,6 @@ def update_or_insert_user(db_name, user_data, mapping_template):
|
|
| 902 |
conn.close()
|
| 903 |
logging.debug(f"User with email {email} processed successfully")
|
| 904 |
|
| 905 |
-
|
| 906 |
-
@app.route('/send_request', methods=['POST'])
|
| 907 |
-
def send_request():
|
| 908 |
-
token = request.form.get('token')
|
| 909 |
-
min_date = request.form.get('minDate')
|
| 910 |
-
type = request.form.get('type')
|
| 911 |
-
url = f'https://online.bizon365.ru/api/v1/webinars/reports/getlist?minDate={min_date}&type={type}'
|
| 912 |
-
|
| 913 |
-
response = requests.get(url, headers={'X-Token': token})
|
| 914 |
-
|
| 915 |
-
if response.status_code == 200:
|
| 916 |
-
data = response.json()
|
| 917 |
-
webinar_ids = [item['webinarId'] for item in data['list']]
|
| 918 |
-
return jsonify(webinar_ids)
|
| 919 |
-
else:
|
| 920 |
-
return jsonify({'error': 'Failed to fetch data from the API'}), response.status_code
|
| 921 |
-
|
| 922 |
@app.route('/send_get_request', methods=['GET'])
|
| 923 |
def send_get_request():
|
| 924 |
token = request.args.get('token')
|
|
|
|
| 849 |
"vk_id", "chat_id", "ws_st", "ws_stop", "web_st", "fin_prog",
|
| 850 |
"b_city", "b_fin", "b_ban", "b_ign", "b_baners", "b_butt", "b_mess",
|
| 851 |
"shop_st", "curator", "pr1", "pr2", "pr3", "pr4", "pr5", "ad_url",
|
| 852 |
+
"key_pr", "n_con", "canal", "data_t", 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content'
|
|
|
|
| 853 |
]
|
| 854 |
for field in required_fields:
|
| 855 |
if field not in transformed_data:
|
|
|
|
| 869 |
if 'phone' in user_data and verifikation_start == "1":
|
| 870 |
phone_verification_result = verify_phone_number(transformed_data['phone'])
|
| 871 |
if phone_verification_result == "true":
|
| 872 |
+
transformed_data['ws_st'] = "True"
|
| 873 |
else:
|
| 874 |
+
transformed_data['ws_st'] = "False"
|
| 875 |
|
| 876 |
# Назначение куратора
|
| 877 |
if curator_on_off == "1":
|
|
|
|
| 901 |
conn.close()
|
| 902 |
logging.debug(f"User with email {email} processed successfully")
|
| 903 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 904 |
@app.route('/send_get_request', methods=['GET'])
|
| 905 |
def send_get_request():
|
| 906 |
token = request.args.get('token')
|