Skip to content

Commit

Permalink
fix:修复用户管理手机号邮箱无法置空bug (#1339)
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoK29 committed Feb 7, 2023
1 parent 59a3a2b commit 1428e11
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion server/service/system/sys_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package system
import (
"errors"
"fmt"
"time"

"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
Expand Down Expand Up @@ -162,7 +164,18 @@ func (userService *UserService) DeleteUser(id int) (err error) {
//@return: err error, user model.SysUser

func (userService *UserService) SetUserInfo(req system.SysUser) error {
return global.GVA_DB.Updates(&req).Error
return global.GVA_DB.Model(&system.SysUser{}).
Select("updated_at", "nick_name", "header_img", "phone", "email", "sideMode", "enable").
Where("id=?", req.ID).
Updates(map[string]interface{}{
"updated_at": time.Now(),
"nick_name": req.NickName,
"header_img": req.HeaderImg,
"phone": req.Phone,
"email": req.Email,
"side_mode": req.SideMode,
"enable": req.Enable,
}).Error
}

//@author: [piexlmax](https://github.com/piexlmax)
Expand Down

0 comments on commit 1428e11

Please sign in to comment.