Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -233,14 +233,22 @@ def get_user():
|
|
233 |
conn.close()
|
234 |
|
235 |
if user:
|
236 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
else:
|
238 |
return jsonify({"error": "User not found"}), 404
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
-
|
244 |
# Отдаем дату онлайн
|
245 |
@app.route('/get_current_time', methods=['GET'])
|
246 |
def get_current_time():
|
|
|
233 |
conn.close()
|
234 |
|
235 |
if user:
|
236 |
+
user_dict = dict(user)
|
237 |
+
|
238 |
+
# Преобразование строки "orders" в JSON-объект
|
239 |
+
if 'orders' in user_dict and isinstance(user_dict['orders'], str):
|
240 |
+
try:
|
241 |
+
user_dict['orders'] = json.loads(user_dict['orders'])
|
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():
|