1
0

feat: 合并代码

This commit is contained in:
TsMask
2023-10-26 09:33:51 +08:00
parent d63db9dd6c
commit 08a908c3f4
38 changed files with 780 additions and 203 deletions

View File

@@ -132,6 +132,16 @@ func (s *SysUserController) Add(c *gin.Context) {
return
}
// 密码单独取,避免序列化输出
var bodyPassword struct {
Password string `json:"password" binding:"required"`
}
if err := c.ShouldBindBodyWith(&bodyPassword, binding.JSON); err != nil {
c.JSON(400, result.CodeMsg(400, "参数错误"))
return
}
body.Password = bodyPassword.Password
// 检查用户登录账号是否唯一
uniqueUserName := s.sysUserService.CheckUniqueUserName(body.UserName, "")
if !uniqueUserName {
@@ -246,6 +256,8 @@ func (s *SysUserController) Edit(c *gin.Context) {
body.UserName = "" // 忽略修改登录用户名称
body.Password = "" // 忽略修改密码
body.LoginIP = "" // 忽略登录IP
body.LoginDate = 0 // 忽略登录时间
body.UpdateBy = ctx.LoginUserToUserName(c)
rows := s.sysUserService.UpdateUserAndRolePost(body)
if rows > 0 {
@@ -310,12 +322,12 @@ func (s *SysUserController) ResetPwd(c *gin.Context) {
}
userName := ctx.LoginUserToUserName(c)
SysUserController := model.SysUser{
info := model.SysUser{
UserID: body.UserID,
Password: body.Password,
UpdateBy: userName,
}
rows := s.sysUserService.UpdateUser(SysUserController)
rows := s.sysUserService.UpdateUser(info)
if rows > 0 {
c.JSON(200, result.Ok(nil))
return
@@ -350,12 +362,12 @@ func (s *SysUserController) Status(c *gin.Context) {
}
userName := ctx.LoginUserToUserName(c)
SysUserController := model.SysUser{
info := model.SysUser{
UserID: body.UserID,
Status: body.Status,
UpdateBy: userName,
}
rows := s.sysUserService.UpdateUser(SysUserController)
rows := s.sysUserService.UpdateUser(info)
if rows > 0 {
c.JSON(200, result.Ok(nil))
return