DmitrMakeev commited on
Commit
ae93c3d
·
verified ·
1 Parent(s): ddde3f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -242,13 +242,19 @@ def get_user():
242
  except json.JSONDecodeError:
243
  user_dict['orders'] = {} # Если не удалось преобразовать, устанавливаем пустой объект
244
 
 
 
 
 
 
 
 
245
  return jsonify(user_dict)
246
  else:
247
  return jsonify({"error": "User not found"}), 404
248
 
249
 
250
 
251
-
252
  # Отдаем дату онлайн
253
  @app.route('/get_current_time', methods=['GET'])
254
  def get_current_time():
 
242
  except json.JSONDecodeError:
243
  user_dict['orders'] = {} # Если не удалось преобразовать, устанавливаем пустой объект
244
 
245
+ # Преобразование строки "bonus" в JSON-объект
246
+ if 'bonus' in user_dict and isinstance(user_dict['bonus'], str):
247
+ try:
248
+ user_dict['bonus'] = json.loads(user_dict['bonus'])
249
+ except json.JSONDecodeError:
250
+ user_dict['bonus'] = {} # Если не удалось преобразовать, устанавливаем пустой объект
251
+
252
  return jsonify(user_dict)
253
  else:
254
  return jsonify({"error": "User not found"}), 404
255
 
256
 
257
 
 
258
  # Отдаем дату онлайн
259
  @app.route('/get_current_time', methods=['GET'])
260
  def get_current_time():