|
|
|
@ -26,7 +26,7 @@ def user_login():
|
|
|
|
|
if user_obj:
|
|
|
|
|
return jsonify(Utils.true_return(msg="登陆成功", data={"token":user_obj, "user_info": Utils.to_dict(user_info)}))
|
|
|
|
|
else:
|
|
|
|
|
return jsonify(Utils.false_return(status=201, msg="登陆失败"))
|
|
|
|
|
return jsonify(Utils.false_return(status=201, msg="账号或密码输入有误!"))
|
|
|
|
|
|
|
|
|
|
# 修改密码,根据token获取用户信息,接受老密码进行校验,新密码写入
|
|
|
|
|
@user_router.route("/update_password", methods=["POST"])
|
|
|
|
@ -73,6 +73,9 @@ def get_user_info_list():
|
|
|
|
|
@token_auth.login_required
|
|
|
|
|
def add_user_info():
|
|
|
|
|
create_user_info = g.current_user
|
|
|
|
|
new_obj = BllUser().execute(f"select * from rms_user where user_code={request.values.get('user_code')} and user_code is not null").fetchone()
|
|
|
|
|
if new_obj:
|
|
|
|
|
return jsonify(Utils.false_return(msg="工号不能重复"))
|
|
|
|
|
try:
|
|
|
|
|
obj = EntityUser(
|
|
|
|
|
real_name=request.values.get("real_name"),
|
|
|
|
@ -88,9 +91,9 @@ def add_user_info():
|
|
|
|
|
create_user_name=create_user_info.real_name,
|
|
|
|
|
is_enabled=request.values.get("is_enabled")
|
|
|
|
|
)
|
|
|
|
|
setattr(obj, "password", Utils.MD5('123456'))
|
|
|
|
|
BllUser().insert(obj)
|
|
|
|
|
# BllUser().update()
|
|
|
|
|
return jsonify(Utils.true_return(msg="添加成功"))
|
|
|
|
|
return jsonify(Utils.true_return(msg=f"添加成功!"))
|
|
|
|
|
except Exception as error:
|
|
|
|
|
return jsonify(Utils.except_return(msg=error))
|
|
|
|
|
|
|
|
|
@ -115,13 +118,15 @@ def update_user_info():
|
|
|
|
|
if not obj:
|
|
|
|
|
return jsonify(Utils.false_return(msg="用户id有误"))
|
|
|
|
|
else:
|
|
|
|
|
new_obj = BllUser().findEntity(
|
|
|
|
|
and_(
|
|
|
|
|
EntityUser.user_code == obj.user_code,
|
|
|
|
|
EntityUser.user_code.isnot(None)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
if obj.user_id != new_obj.user_id:
|
|
|
|
|
# new_obj = BllUser().findEntity(
|
|
|
|
|
# and_(
|
|
|
|
|
# EntityUser.user_code == obj.user_code,
|
|
|
|
|
# EntityUser.user_code.isnot(None)
|
|
|
|
|
# )
|
|
|
|
|
# )
|
|
|
|
|
new_obj = BllUser().execute(f"select * from rms_user where user_code={request.values.get('user_code')} and user_code is not null").fetchone()
|
|
|
|
|
|
|
|
|
|
if new_obj and obj.user_id == new_obj.user_id:
|
|
|
|
|
return jsonify(Utils.false_return(msg="工号不能重复"))
|
|
|
|
|
finds_list = dir(EntityUser)
|
|
|
|
|
for i in finds_list:
|
|
|
|
|