DmitrMakeev
commited on
Commit
•
9353292
1
Parent(s):
93d486a
Update app.py
Browse files
app.py
CHANGED
@@ -1617,7 +1617,6 @@ def gc_forms():
|
|
1617 |
|
1618 |
|
1619 |
|
1620 |
-
# Список кураторов
|
1621 |
curators = ["Anna", "Ekaterina", "Ivan", "Maria", "Sergey", "Olga", "Alex", "Natalia", "Dmitry", "Elena"]
|
1622 |
current_curator_index = 0
|
1623 |
|
@@ -1657,7 +1656,11 @@ mapp_templates = {
|
|
1657 |
}
|
1658 |
|
1659 |
DATABASE_NAME3 = 'data_gc.db'
|
1660 |
-
|
|
|
|
|
|
|
|
|
1661 |
|
1662 |
def verify_phone_number(phone_number):
|
1663 |
if verifikation_start == "1":
|
@@ -1715,20 +1718,27 @@ def add_or_update_contact(contact_data):
|
|
1715 |
def add_data_ver_cur():
|
1716 |
global current_curator_index
|
1717 |
|
|
|
|
|
|
|
1718 |
template_key = request.args.get('template_key', 'avp')
|
1719 |
mapping_template_cur = mapp_templates.get(template_key, mt_avp)
|
1720 |
|
1721 |
user_data = {mapping_template_cur[key]: request.args.get(key, "") for key in mapping_template_cur}
|
1722 |
-
user_data['curator'] = curators[current_curator_index]
|
1723 |
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
|
|
|
|
|
|
|
|
1727 |
|
1728 |
try:
|
1729 |
add_or_update_contact(user_data)
|
1730 |
-
|
1731 |
-
|
|
|
1732 |
except Exception as e:
|
1733 |
logging.error(f"Error adding user: {e}")
|
1734 |
return jsonify({'status': 'error', 'message': str(e)}), 500
|
@@ -1754,7 +1764,6 @@ def add_data_ver_cur():
|
|
1754 |
|
1755 |
|
1756 |
|
1757 |
-
|
1758 |
|
1759 |
|
1760 |
# Шаблон сопоставления для кураторов
|
|
|
1617 |
|
1618 |
|
1619 |
|
|
|
1620 |
curators = ["Anna", "Ekaterina", "Ivan", "Maria", "Sergey", "Olga", "Alex", "Natalia", "Dmitry", "Elena"]
|
1621 |
current_curator_index = 0
|
1622 |
|
|
|
1656 |
}
|
1657 |
|
1658 |
DATABASE_NAME3 = 'data_gc.db'
|
1659 |
+
verifikation_start = "1"
|
1660 |
+
wa_url = "https://api.green-api.com/waInstance1101952913/checkWhatsapp/"
|
1661 |
+
wa_ak = ""
|
1662 |
+
ws_url_ver = ""
|
1663 |
+
wa_api_key = "fb4986a9d9cb40ef9be6c7b08cb9c98b7a3b1dc8c6834b0b92"
|
1664 |
|
1665 |
def verify_phone_number(phone_number):
|
1666 |
if verifikation_start == "1":
|
|
|
1718 |
def add_data_ver_cur():
|
1719 |
global current_curator_index
|
1720 |
|
1721 |
+
veref_on_off = request.args.get('ver', '0') # Включает "1" и выключает "0" верификацию номера вместо verifikation_start
|
1722 |
+
curator_on_off = request.args.get('cur', '0') # Включает "1" и выключает "0" назначение куратора
|
1723 |
+
|
1724 |
template_key = request.args.get('template_key', 'avp')
|
1725 |
mapping_template_cur = mapp_templates.get(template_key, mt_avp)
|
1726 |
|
1727 |
user_data = {mapping_template_cur[key]: request.args.get(key, "") for key in mapping_template_cur}
|
|
|
1728 |
|
1729 |
+
if curator_on_off == "1":
|
1730 |
+
user_data['curator'] = curators[current_curator_index]
|
1731 |
+
|
1732 |
+
if veref_on_off == "1":
|
1733 |
+
phone_verification_response = verify_phone_number(user_data.get('phone', ''))
|
1734 |
+
if phone_verification_response is not None:
|
1735 |
+
user_data['ws_st'] = phone_verification_response
|
1736 |
|
1737 |
try:
|
1738 |
add_or_update_contact(user_data)
|
1739 |
+
if curator_on_off == "1":
|
1740 |
+
current_curator_index = (current_curator_index + 1) % len(curators)
|
1741 |
+
return jsonify({'status': 'success', 'message': f'User added with curator {user_data.get("curator", "not assigned")}'})
|
1742 |
except Exception as e:
|
1743 |
logging.error(f"Error adding user: {e}")
|
1744 |
return jsonify({'status': 'error', 'message': str(e)}), 500
|
|
|
1764 |
|
1765 |
|
1766 |
|
|
|
1767 |
|
1768 |
|
1769 |
# Шаблон сопоставления для кураторов
|