From e94697ec68d5db452cd4ffb916cf3b100bed32d0 Mon Sep 17 00:00:00 2001 From: helojo Date: Mon, 28 Apr 2025 10:32:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=A7=A3=E5=86=B3=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E5=A4=B1=E8=B4=A5=EF=BC=8C=E4=BD=86=E5=89=8D?= =?UTF-8?q?=E5=8F=B0=E8=BF=94=E5=9B=9E=E5=88=9B=E5=BB=BA=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E5=88=9B=E5=BB=BA=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E6=97=B6=E8=BF=94=E5=9B=9E=E7=9C=9F=E5=AE=9E=E7=9A=84?= =?UTF-8?q?=E7=8A=B6=E6=80=81=20(#57)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: zqgame --- management/server/routes/users/routes.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/management/server/routes/users/routes.py b/management/server/routes/users/routes.py index ee9283c..de4945d 100644 --- a/management/server/routes/users/routes.py +++ b/management/server/routes/users/routes.py @@ -45,11 +45,23 @@ def create_user_route(): """创建用户的API端点""" data = request.json # 创建用户 - create_user(user_data=data) - return jsonify({ - "code": 0, - "message": "用户创建成功" - }) + try: + success = create_user(user_data=data) + if success: + return jsonify({ + "code": 0, + "message": "用户创建成功" + }) + else: + return jsonify({ + "code": 400, + "message": "用户创建失败" + }), 400 + except Exception as e: + return jsonify({ + "code": 500, + "message": f"用户创建失败: {str(e)}" + }), 500 @users_bp.route('/', methods=['PUT']) def update_user_route(user_id):