Update app.py
Browse files
app.py
CHANGED
|
@@ -1674,7 +1674,7 @@ def verify_phone_number(phone_number):
|
|
| 1674 |
else:
|
| 1675 |
print("Verification not started")
|
| 1676 |
return "Verification not started"
|
| 1677 |
-
|
| 1678 |
# Функция для добавления или обновления контакта в базе данных
|
| 1679 |
def add_or_update_contact(contact_data):
|
| 1680 |
conn = sqlite3.connect(DATABASE_NAME3)
|
|
@@ -1689,9 +1689,7 @@ def add_or_update_contact(contact_data):
|
|
| 1689 |
contact = cursor.fetchone()
|
| 1690 |
|
| 1691 |
# List all fields for updating or inserting
|
| 1692 |
-
fields =
|
| 1693 |
-
"b_ign", "b_baners", "b_butt", "b_mess", "shop_st", "curator", "pr1", "pr2", "pr3", "pr4",
|
| 1694 |
-
"pr5", "ad_url", "key_pr", "n_con", "canal", "data_t"]
|
| 1695 |
|
| 1696 |
placeholders = ", ".join([f"{field} = ?" for field in fields])
|
| 1697 |
|
|
@@ -1712,37 +1710,13 @@ def add_data_ver():
|
|
| 1712 |
'name': request.args.get('name', ''),
|
| 1713 |
'phone': request.args.get('phone', ''),
|
| 1714 |
'email': request.args.get('email', ''),
|
| 1715 |
-
'
|
| 1716 |
-
'chat_id': request.args.get('chat_id', ''),
|
| 1717 |
-
'ws_st': request.args.get('ws_st', ''),
|
| 1718 |
-
'ws_stop': request.args.get('ws_stop', ''),
|
| 1719 |
-
'web_st': request.args.get('web_st', ''),
|
| 1720 |
-
'fin_prog': request.args.get('fin_prog', ''),
|
| 1721 |
-
'b_city': request.args.get('b_city', ''),
|
| 1722 |
-
'b_fin': request.args.get('b_fin', ''),
|
| 1723 |
-
'b_ban': request.args.get('b_ban', ''),
|
| 1724 |
-
'b_ign': request.args.get('b_ign', ''),
|
| 1725 |
-
'b_baners': request.args.get('b_baners', ''),
|
| 1726 |
-
'b_butt': request.args.get('b_butt', ''),
|
| 1727 |
-
'b_mess': request.args.get('b_mess', ''),
|
| 1728 |
-
'shop_st': request.args.get('shop_st', ''),
|
| 1729 |
-
'curator': request.args.get('curator', ''),
|
| 1730 |
-
'pr1': request.args.get('pr1', ''),
|
| 1731 |
-
'pr2': request.args.get('pr2', ''),
|
| 1732 |
-
'pr3': request.args.get('pr3', ''),
|
| 1733 |
-
'pr4': request.args.get('pr4', ''),
|
| 1734 |
-
'pr5': request.args.get('pr5', ''),
|
| 1735 |
-
'ad_url': request.args.get('ad_url', ''),
|
| 1736 |
-
'key_pr': request.args.get('key_pr', ''),
|
| 1737 |
-
'n_con': request.args.get('n_con', ''),
|
| 1738 |
-
'canal': request.args.get('canal', ''),
|
| 1739 |
-
'data_t': request.args.get('data_t', '')
|
| 1740 |
}
|
| 1741 |
|
| 1742 |
# Получение значения проверки номера телефона
|
| 1743 |
phone_verification_response = verify_phone_number(contact_data['phone'])
|
| 1744 |
if phone_verification_response is not None:
|
| 1745 |
-
contact_data['
|
| 1746 |
|
| 1747 |
try:
|
| 1748 |
add_or_update_contact(contact_data)
|
|
@@ -1763,7 +1737,6 @@ def add_data_ver():
|
|
| 1763 |
|
| 1764 |
|
| 1765 |
|
| 1766 |
-
|
| 1767 |
initialize_requests()
|
| 1768 |
|
| 1769 |
|
|
|
|
| 1674 |
else:
|
| 1675 |
print("Verification not started")
|
| 1676 |
return "Verification not started"
|
| 1677 |
+
REQUIRED_FIELDS = ["name", "phone", "email", "ws_st", "ws_stop", "data_t"]
|
| 1678 |
# Функция для добавления или обновления контакта в базе данных
|
| 1679 |
def add_or_update_contact(contact_data):
|
| 1680 |
conn = sqlite3.connect(DATABASE_NAME3)
|
|
|
|
| 1689 |
contact = cursor.fetchone()
|
| 1690 |
|
| 1691 |
# List all fields for updating or inserting
|
| 1692 |
+
fields = REQUIRED_FIELDS
|
|
|
|
|
|
|
| 1693 |
|
| 1694 |
placeholders = ", ".join([f"{field} = ?" for field in fields])
|
| 1695 |
|
|
|
|
| 1710 |
'name': request.args.get('name', ''),
|
| 1711 |
'phone': request.args.get('phone', ''),
|
| 1712 |
'email': request.args.get('email', ''),
|
| 1713 |
+
'ws_st': request.args.get('ws_st', '')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1714 |
}
|
| 1715 |
|
| 1716 |
# Получение значения проверки номера телефона
|
| 1717 |
phone_verification_response = verify_phone_number(contact_data['phone'])
|
| 1718 |
if phone_verification_response is not None:
|
| 1719 |
+
contact_data['ws_stop'] = phone_verification_response # Сохраняем значение в поле ws_stop
|
| 1720 |
|
| 1721 |
try:
|
| 1722 |
add_or_update_contact(contact_data)
|
|
|
|
| 1737 |
|
| 1738 |
|
| 1739 |
|
|
|
|
| 1740 |
initialize_requests()
|
| 1741 |
|
| 1742 |
|