Update app.py
Browse files
app.py
CHANGED
|
@@ -417,6 +417,9 @@ def add_data_gc():
|
|
| 417 |
pr5 = request.args.get('pr5')
|
| 418 |
ad_url = request.args.get('ad_url')
|
| 419 |
curator = request.args.get('curator')
|
|
|
|
|
|
|
|
|
|
| 420 |
|
| 421 |
if not name or not phone or not email:
|
| 422 |
return "Parameters 'name', 'phone', and 'email' are required.", 400
|
|
@@ -425,6 +428,12 @@ def add_data_gc():
|
|
| 425 |
if phone.startswith('+'):
|
| 426 |
phone = phone[1:]
|
| 427 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 428 |
conn = sqlite3.connect('data_gc.db')
|
| 429 |
cursor = conn.cursor()
|
| 430 |
cursor.execute('SELECT * FROM contacts WHERE phone = ? OR email = ?', (phone, email))
|
|
@@ -435,18 +444,20 @@ def add_data_gc():
|
|
| 435 |
UPDATE contacts SET
|
| 436 |
name = ?, email = ?, vk_id = ?, chat_id = ?, ws_statys = ?, ws_stop = ?,
|
| 437 |
web_statys = ?, fin_progress = ?, shop_statys_full = ?, pr1 = ?, pr2 = ?,
|
| 438 |
-
pr3 = ?, pr4 = ?, pr5 = ?, ad_url = ?, curator =
|
|
|
|
| 439 |
WHERE phone = ? OR email = ?
|
| 440 |
''', (name, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 441 |
-
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator,
|
|
|
|
| 442 |
else:
|
| 443 |
cursor.execute('''
|
| 444 |
INSERT INTO contacts (
|
| 445 |
name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 446 |
-
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator
|
| 447 |
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
| 448 |
''', (name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 449 |
-
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator))
|
| 450 |
|
| 451 |
conn.commit()
|
| 452 |
conn.close()
|
|
@@ -463,9 +474,6 @@ def add_data_gc():
|
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
@app.route('/add_data_ras', methods=['GET'])
|
| 470 |
def add_data_ras():
|
| 471 |
try:
|
|
@@ -491,6 +499,9 @@ def add_data_ras():
|
|
| 491 |
pr5 = request.args.get('pr5', '')
|
| 492 |
ad_url = request.args.get('ad_url', '')
|
| 493 |
curator = request.args.get('curator', '')
|
|
|
|
|
|
|
|
|
|
| 494 |
|
| 495 |
if not name or not phone or not email:
|
| 496 |
return "Parameters 'name', 'phone', and 'email' are required.", 400
|
|
@@ -499,6 +510,12 @@ def add_data_ras():
|
|
| 499 |
if phone.startswith('+'):
|
| 500 |
phone = phone[1:]
|
| 501 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 502 |
conn = sqlite3.connect('data1.db')
|
| 503 |
cursor = conn.cursor()
|
| 504 |
cursor.execute('SELECT * FROM contacts WHERE phone = ? OR email = ?', (phone, email))
|
|
@@ -509,18 +526,20 @@ def add_data_ras():
|
|
| 509 |
UPDATE contacts SET
|
| 510 |
name = ?, email = ?, vk_id = ?, chat_id = ?, ws_statys = ?, ws_stop = ?,
|
| 511 |
web_statys = ?, fin_progress = ?, shop_statys_full = ?, pr1 = ?, pr2 = ?,
|
| 512 |
-
pr3 = ?, pr4 = ?, pr5 = ?, ad_url = ?, curator =
|
|
|
|
| 513 |
WHERE phone = ? OR email = ?
|
| 514 |
''', (name, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 515 |
-
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator,
|
|
|
|
| 516 |
else:
|
| 517 |
cursor.execute('''
|
| 518 |
INSERT INTO contacts (
|
| 519 |
name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 520 |
-
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator
|
| 521 |
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
| 522 |
''', (name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 523 |
-
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator))
|
| 524 |
|
| 525 |
conn.commit()
|
| 526 |
conn.close()
|
|
|
|
| 417 |
pr5 = request.args.get('pr5')
|
| 418 |
ad_url = request.args.get('ad_url')
|
| 419 |
curator = request.args.get('curator')
|
| 420 |
+
key_pr = request.args.get('key_pr', '')
|
| 421 |
+
n_con = request.args.get('n_con', '')
|
| 422 |
+
canal = request.args.get('canal', '')
|
| 423 |
|
| 424 |
if not name or not phone or not email:
|
| 425 |
return "Parameters 'name', 'phone', and 'email' are required.", 400
|
|
|
|
| 428 |
if phone.startswith('+'):
|
| 429 |
phone = phone[1:]
|
| 430 |
|
| 431 |
+
# Получение текущего времени в московском часовом поясе
|
| 432 |
+
utc_now = datetime.utcnow()
|
| 433 |
+
msk_tz = pytz.timezone('Europe/Moscow')
|
| 434 |
+
msk_now = utc_now.replace(tzinfo=pytz.utc).astimezone(msk_tz)
|
| 435 |
+
data_t = msk_now.strftime('%Y-%m-%d %H:%M:%S')
|
| 436 |
+
|
| 437 |
conn = sqlite3.connect('data_gc.db')
|
| 438 |
cursor = conn.cursor()
|
| 439 |
cursor.execute('SELECT * FROM contacts WHERE phone = ? OR email = ?', (phone, email))
|
|
|
|
| 444 |
UPDATE contacts SET
|
| 445 |
name = ?, email = ?, vk_id = ?, chat_id = ?, ws_statys = ?, ws_stop = ?,
|
| 446 |
web_statys = ?, fin_progress = ?, shop_statys_full = ?, pr1 = ?, pr2 = ?,
|
| 447 |
+
pr3 = ?, pr4 = ?, pr5 = ?, ad_url = ?, curator = ?, key_pr = ?, n_con = ?,
|
| 448 |
+
canal = ?, data_t = ?
|
| 449 |
WHERE phone = ? OR email = ?
|
| 450 |
''', (name, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 451 |
+
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator, key_pr, n_con,
|
| 452 |
+
canal, data_t, phone, email))
|
| 453 |
else:
|
| 454 |
cursor.execute('''
|
| 455 |
INSERT INTO contacts (
|
| 456 |
name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 457 |
+
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator, key_pr, n_con, canal, data_t
|
| 458 |
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
| 459 |
''', (name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 460 |
+
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator, key_pr, n_con, canal, data_t))
|
| 461 |
|
| 462 |
conn.commit()
|
| 463 |
conn.close()
|
|
|
|
| 474 |
|
| 475 |
|
| 476 |
|
|
|
|
|
|
|
|
|
|
| 477 |
@app.route('/add_data_ras', methods=['GET'])
|
| 478 |
def add_data_ras():
|
| 479 |
try:
|
|
|
|
| 499 |
pr5 = request.args.get('pr5', '')
|
| 500 |
ad_url = request.args.get('ad_url', '')
|
| 501 |
curator = request.args.get('curator', '')
|
| 502 |
+
key_pr = request.args.get('key_pr', '')
|
| 503 |
+
n_con = request.args.get('n_con', '')
|
| 504 |
+
canal = request.args.get('canal', '')
|
| 505 |
|
| 506 |
if not name or not phone or not email:
|
| 507 |
return "Parameters 'name', 'phone', and 'email' are required.", 400
|
|
|
|
| 510 |
if phone.startswith('+'):
|
| 511 |
phone = phone[1:]
|
| 512 |
|
| 513 |
+
# Получение текущего времени в московском часовом поясе
|
| 514 |
+
utc_now = datetime.utcnow()
|
| 515 |
+
msk_tz = pytz.timezone('Europe/Moscow')
|
| 516 |
+
msk_now = utc_now.replace(tzinfo=pytz.utc).astimezone(msk_tz)
|
| 517 |
+
data_t = msk_now.strftime('%Y-%m-%d %H:%M:%S')
|
| 518 |
+
|
| 519 |
conn = sqlite3.connect('data1.db')
|
| 520 |
cursor = conn.cursor()
|
| 521 |
cursor.execute('SELECT * FROM contacts WHERE phone = ? OR email = ?', (phone, email))
|
|
|
|
| 526 |
UPDATE contacts SET
|
| 527 |
name = ?, email = ?, vk_id = ?, chat_id = ?, ws_statys = ?, ws_stop = ?,
|
| 528 |
web_statys = ?, fin_progress = ?, shop_statys_full = ?, pr1 = ?, pr2 = ?,
|
| 529 |
+
pr3 = ?, pr4 = ?, pr5 = ?, ad_url = ?, curator = ?, key_pr = ?, n_con = ?,
|
| 530 |
+
canal = ?, data_t = ?
|
| 531 |
WHERE phone = ? OR email = ?
|
| 532 |
''', (name, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 533 |
+
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator, key_pr, n_con,
|
| 534 |
+
canal, data_t, phone, email))
|
| 535 |
else:
|
| 536 |
cursor.execute('''
|
| 537 |
INSERT INTO contacts (
|
| 538 |
name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 539 |
+
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator, key_pr, n_con, canal, data_t
|
| 540 |
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
| 541 |
''', (name, phone, email, vk_id, chat_id, ws_statys, ws_stop, web_statys, fin_progress,
|
| 542 |
+
shop_statys_full, pr1, pr2, pr3, pr4, pr5, ad_url, curator, key_pr, n_con, canal, data_t))
|
| 543 |
|
| 544 |
conn.commit()
|
| 545 |
conn.close()
|