Update app.py
Browse files
app.py
CHANGED
|
@@ -174,6 +174,7 @@ def add_data_gc():
|
|
| 174 |
pr4 = request.args.get('pr4', '')
|
| 175 |
pr5 = request.args.get('pr5', '')
|
| 176 |
ad_url = request.args.get('ad_url', '')
|
|
|
|
| 177 |
|
| 178 |
if not name or not phone or not email:
|
| 179 |
return "Parameters 'name', 'phone', and 'email' are required.", 400
|
|
@@ -192,18 +193,18 @@ def add_data_gc():
|
|
| 192 |
UPDATE contacts SET
|
| 193 |
name = ?, email = ?, vk_id = ?, chat_id = ?, ws_statys = ?, ws_stop = ?,
|
| 194 |
web_statys = ?, fin_progress = ?, shop_statys_full = ?, pr1 = ?, pr2 = ?,
|
| 195 |
-
pr3 = ?, pr4 = ?, pr5 = ?, ad_url = ?
|
| 196 |
WHERE phone = ? OR email = ?
|
| 197 |
''', (name, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 198 |
-
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, phone, email))
|
| 199 |
else:
|
| 200 |
cursor.execute('''
|
| 201 |
INSERT INTO contacts (
|
| 202 |
name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 203 |
-
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url
|
| 204 |
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
| 205 |
''', (name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 206 |
-
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url))
|
| 207 |
|
| 208 |
conn.commit()
|
| 209 |
conn.close()
|
|
@@ -241,6 +242,7 @@ def add_contact():
|
|
| 241 |
pr4 = request.args.get('pr4', '')
|
| 242 |
pr5 = request.args.get('pr5', '')
|
| 243 |
ad_url = request.args.get('ad_url', '')
|
|
|
|
| 244 |
|
| 245 |
if not name or not phone or not email:
|
| 246 |
return "Parameters 'name', 'phone', and 'email' are required.", 400
|
|
@@ -259,18 +261,18 @@ def add_contact():
|
|
| 259 |
UPDATE contacts SET
|
| 260 |
name = ?, email = ?, vk_id = ?, chat_id = ?, ws_statys = ?, ws_stop = ?,
|
| 261 |
web_statys = ?, fin_progress = ?, shop_statys_full = ?, pr1 = ?, pr2 = ?,
|
| 262 |
-
pr3 = ?, pr4 = ?, pr5 = ?, ad_url = ?
|
| 263 |
WHERE phone = ? OR email = ?
|
| 264 |
''', (name, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 265 |
-
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, phone, email))
|
| 266 |
else:
|
| 267 |
cursor.execute('''
|
| 268 |
INSERT INTO contacts (
|
| 269 |
name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 270 |
-
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url
|
| 271 |
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
| 272 |
''', (name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 273 |
-
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url))
|
| 274 |
|
| 275 |
conn.commit()
|
| 276 |
conn.close()
|
|
@@ -337,7 +339,7 @@ def data_gc_tab_out():
|
|
| 337 |
cursor = conn.cursor()
|
| 338 |
cursor.execute('''
|
| 339 |
SELECT id, name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 340 |
-
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url
|
| 341 |
FROM contacts
|
| 342 |
''')
|
| 343 |
contacts = cursor.fetchall()
|
|
@@ -348,7 +350,7 @@ def data_gc_tab_out():
|
|
| 348 |
'vk_id': contact[4], 'chat_id': contact[5], 'ws_statys': contact[6], 'ws_stop': contact[7],
|
| 349 |
'web_statys': contact[8], 'fin_progress': contact[9], 'shop_statys_full': contact[10],
|
| 350 |
'pr1': contact[11], 'pr2': contact[12], 'pr3': contact[13], 'pr4': contact[14],
|
| 351 |
-
'pr5': contact[15], 'ad_url': contact[16]
|
| 352 |
} for contact in contacts]
|
| 353 |
return jsonify(contacts_json), 200
|
| 354 |
except Exception as e:
|
|
|
|
| 174 |
pr4 = request.args.get('pr4', '')
|
| 175 |
pr5 = request.args.get('pr5', '')
|
| 176 |
ad_url = request.args.get('ad_url', '')
|
| 177 |
+
curator = request.args.get('curator', '')
|
| 178 |
|
| 179 |
if not name or not phone or not email:
|
| 180 |
return "Parameters 'name', 'phone', and 'email' are required.", 400
|
|
|
|
| 193 |
UPDATE contacts SET
|
| 194 |
name = ?, email = ?, vk_id = ?, chat_id = ?, ws_statys = ?, ws_stop = ?,
|
| 195 |
web_statys = ?, fin_progress = ?, shop_statys_full = ?, pr1 = ?, pr2 = ?,
|
| 196 |
+
pr3 = ?, pr4 = ?, pr5 = ?, ad_url = ?, curator = ?
|
| 197 |
WHERE phone = ? OR email = ?
|
| 198 |
''', (name, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 199 |
+
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator, phone, email))
|
| 200 |
else:
|
| 201 |
cursor.execute('''
|
| 202 |
INSERT INTO contacts (
|
| 203 |
name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 204 |
+
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator
|
| 205 |
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
| 206 |
''', (name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 207 |
+
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator))
|
| 208 |
|
| 209 |
conn.commit()
|
| 210 |
conn.close()
|
|
|
|
| 242 |
pr4 = request.args.get('pr4', '')
|
| 243 |
pr5 = request.args.get('pr5', '')
|
| 244 |
ad_url = request.args.get('ad_url', '')
|
| 245 |
+
curator = request.args.get('curator', '')
|
| 246 |
|
| 247 |
if not name or not phone or not email:
|
| 248 |
return "Parameters 'name', 'phone', and 'email' are required.", 400
|
|
|
|
| 261 |
UPDATE contacts SET
|
| 262 |
name = ?, email = ?, vk_id = ?, chat_id = ?, ws_statys = ?, ws_stop = ?,
|
| 263 |
web_statys = ?, fin_progress = ?, shop_statys_full = ?, pr1 = ?, pr2 = ?,
|
| 264 |
+
pr3 = ?, pr4 = ?, pr5 = ?, ad_url = ?, curator = ?
|
| 265 |
WHERE phone = ? OR email = ?
|
| 266 |
''', (name, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 267 |
+
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator, phone, email))
|
| 268 |
else:
|
| 269 |
cursor.execute('''
|
| 270 |
INSERT INTO contacts (
|
| 271 |
name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 272 |
+
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator
|
| 273 |
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
| 274 |
''', (name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 275 |
+
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator))
|
| 276 |
|
| 277 |
conn.commit()
|
| 278 |
conn.close()
|
|
|
|
| 339 |
cursor = conn.cursor()
|
| 340 |
cursor.execute('''
|
| 341 |
SELECT id, name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 342 |
+
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator
|
| 343 |
FROM contacts
|
| 344 |
''')
|
| 345 |
contacts = cursor.fetchall()
|
|
|
|
| 350 |
'vk_id': contact[4], 'chat_id': contact[5], 'ws_statys': contact[6], 'ws_stop': contact[7],
|
| 351 |
'web_statys': contact[8], 'fin_progress': contact[9], 'shop_statys_full': contact[10],
|
| 352 |
'pr1': contact[11], 'pr2': contact[12], 'pr3': contact[13], 'pr4': contact[14],
|
| 353 |
+
'pr5': contact[15], 'ad_url': contact[16], 'curator': contact[17]
|
| 354 |
} for contact in contacts]
|
| 355 |
return jsonify(contacts_json), 200
|
| 356 |
except Exception as e:
|