DmitrMakeev commited on
Commit
59d76d0
·
verified ·
1 Parent(s): 69c325f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -832,6 +832,24 @@ def update_or_insert_user(db_name, user_data, mapping_template):
832
 
833
  transformed_data['web_st'] = web_st_value
834
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
835
  if user:
836
  update_query = "UPDATE contacts SET "
837
  update_values = []
@@ -851,7 +869,7 @@ def update_or_insert_user(db_name, user_data, mapping_template):
851
  conn.commit()
852
  conn.close()
853
 
854
-
855
 
856
  @app.route('/send_get_request', methods=['GET'])
857
  def send_get_request():
 
832
 
833
  transformed_data['web_st'] = web_st_value
834
 
835
+ # Проверка наличия массива сообщений и установка значения
836
+ if 'messages' in user_data and isinstance(user_data['messages'], list):
837
+ transformed_data['b_mess'] = json.dumps(user_data['messages'])
838
+ else:
839
+ transformed_data['b_mess'] = ""
840
+
841
+ # Проверка наличия массива баннеров и установка значения
842
+ if 'banners' in user_data and isinstance(user_data['banners'], list):
843
+ transformed_data['b_baners'] = '1'
844
+ else:
845
+ transformed_data['b_baners'] = '0'
846
+
847
+ # Проверка наличия массива кнопок и установка значения
848
+ if 'buttons' in user_data and isinstance(user_data['buttons'], list):
849
+ transformed_data['b_butt'] = '1'
850
+ else:
851
+ transformed_data['b_butt'] = '0'
852
+
853
  if user:
854
  update_query = "UPDATE contacts SET "
855
  update_values = []
 
869
  conn.commit()
870
  conn.close()
871
 
872
+ app = Flask(__name__)
873
 
874
  @app.route('/send_get_request', methods=['GET'])
875
  def send_get_request():