DmitrMakeev commited on
Commit
a13abe4
·
verified ·
1 Parent(s): 8d8aca8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -40
app.py CHANGED
@@ -187,7 +187,7 @@ def get_db_connection_user():
187
  conn.row_factory = sqlite3.Row
188
  return conn
189
 
190
- @app.route('/user_db_set', methods=['GET','POST'])
191
  def get_user():
192
  # Проверка API-ключа
193
  api_key_sys_control = request.args.get('api_sys')
@@ -248,7 +248,7 @@ def get_user():
248
 
249
 
250
  # Отдаем дату онлайн
251
- @app.route('/get_current_time', methods=['GET','POST'])
252
  def get_current_time():
253
  utc_now = datetime.utcnow()
254
  msk_tz = pytz.timezone('Europe/Moscow')
@@ -416,7 +416,7 @@ def add_or_update_contact(contact_data, db_name):
416
 
417
 
418
 
419
- @app.route('/add_user_home', methods=['GET','POST'])
420
  def add_user_home():
421
  global current_curator_index
422
 
@@ -456,7 +456,7 @@ def add_user_home():
456
  logging.error(f"Error adding user: {e}")
457
  return jsonify({'status': 'error', 'message': str(e)}), 500
458
 
459
- @app.route('/user', methods=['GET','POST'])
460
  def user():
461
  global current_curator_index
462
 
@@ -496,7 +496,7 @@ def user():
496
  logging.error(f"Error adding user: {e}")
497
  return jsonify({'status': 'error', 'message': str(e)}), 500
498
 
499
- @app.route('/add_user_mess', methods=['GET','POST'])
500
  def add_user_mess():
501
  global current_curator_index
502
 
@@ -625,49 +625,25 @@ def shop_order_new():
625
 
626
 
627
  # Работа из VK_ID Запись ордер с полными данными
628
-
629
- @app.route('/wr_order_vk_full', methods=['GET', 'POST'])
630
  def write_order_vk_full():
631
  try:
632
  logging.debug("Starting shop_order_new")
633
- api_sys_control = request.args.get('api_sys')
634
 
 
 
635
  if api_sys_control != api_key_sys:
636
  logging.warning("Unauthorized access attempt")
637
  return json.dumps({"error": "Unauthorized access"}), 403
638
 
639
- # Читаем параметры из GET-запроса
640
- name = request.args.get('name', '')
641
- email = request.args.get('email', '')
642
- vkid = request.args.get('vk_id', '')
643
- phone = request.args.get('phone', '').lstrip('+')
644
- order = request.args.get('order', '')
645
- status = request.args.get('status', '')
646
- del_flag = request.args.get('del', '')
647
- n_con_flag = request.args.get('n_con', '')
648
-
649
- # Читаем параметры из POST-запроса (формы)
650
- if request.method == 'POST':
651
- name = request.form.get('name', name)
652
- email = request.form.get('email', email)
653
- vkid = request.form.get('vk_id', vkid)
654
- phone = request.form.get('phone', phone).lstrip('+')
655
- order = request.form.get('order', order)
656
- status = request.form.get('status', status)
657
- del_flag = request.form.get('del', del_flag)
658
- n_con_flag = request.form.get('n_con', n_con_flag)
659
-
660
- # Читаем параметры из POST-запроса (JSON)
661
- if request.is_json:
662
- json_data = request.get_json()
663
- name = json_data.get('name', name)
664
- email = json_data.get('email', email)
665
- vkid = json_data.get('vk_id', vkid)
666
- phone = json_data.get('phone', phone).lstrip('+')
667
- order = json_data.get('order', order)
668
- status = json_data.get('status', status)
669
- del_flag = json_data.get('del', del_flag)
670
- n_con_flag = json_data.get('n_con', n_con_flag)
671
 
672
  if not email or not phone:
673
  logging.error("Email and phone are required")
 
187
  conn.row_factory = sqlite3.Row
188
  return conn
189
 
190
+ @app.route('/user_db_set', methods=['GET'])
191
  def get_user():
192
  # Проверка API-ключа
193
  api_key_sys_control = request.args.get('api_sys')
 
248
 
249
 
250
  # Отдаем дату онлайн
251
+ @app.route('/get_current_time', methods=['GET'])
252
  def get_current_time():
253
  utc_now = datetime.utcnow()
254
  msk_tz = pytz.timezone('Europe/Moscow')
 
416
 
417
 
418
 
419
+ @app.route('/add_user_home', methods=['GET'])
420
  def add_user_home():
421
  global current_curator_index
422
 
 
456
  logging.error(f"Error adding user: {e}")
457
  return jsonify({'status': 'error', 'message': str(e)}), 500
458
 
459
+ @app.route('/user', methods=['GET'])
460
  def user():
461
  global current_curator_index
462
 
 
496
  logging.error(f"Error adding user: {e}")
497
  return jsonify({'status': 'error', 'message': str(e)}), 500
498
 
499
+ @app.route('/add_user_mess', methods=['GET'])
500
  def add_user_mess():
501
  global current_curator_index
502
 
 
625
 
626
 
627
  # Работа из VK_ID Запись ордер с полными данными
628
+ @app.route('/wr_order_vk_full', methods=['POST'])
 
629
  def write_order_vk_full():
630
  try:
631
  logging.debug("Starting shop_order_new")
 
632
 
633
+ # Читаем параметры из POST-запроса (формы)
634
+ api_sys_control = request.form.get('api_sys')
635
  if api_sys_control != api_key_sys:
636
  logging.warning("Unauthorized access attempt")
637
  return json.dumps({"error": "Unauthorized access"}), 403
638
 
639
+ name = request.form.get('name', '')
640
+ email = request.form.get('email', '')
641
+ vkid = request.form.get('vk_id', '')
642
+ phone = request.form.get('phone', '').lstrip('+')
643
+ order = request.form.get('order', '')
644
+ status = request.form.get('status', '')
645
+ del_flag = request.form.get('del', '')
646
+ n_con_flag = request.form.get('n_con', '')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
647
 
648
  if not email or not phone:
649
  logging.error("Email and phone are required")