fix: 修复更新用户的逻辑bug (#282)

This commit is contained in:
二丫讲梵 2023-11-15 23:32:51 +08:00 committed by GitHub
parent 5343539efe
commit d00d6df8a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 11 deletions

View File

@ -217,23 +217,21 @@ func (l UserLogic) Update(c *gin.Context, req interface{}) (data interface{}, rs
return nil, tools.NewMySqlError(err) return nil, tools.NewMySqlError(err)
} }
// 过滤掉前端会选择到的 请选择部门信息 这个选项
var ( var (
depts string depts string
deptids []uint deptids []uint
) )
if strings.Contains(r.Departments, "请选择部门信息") { for _, v := range strings.Split(r.Departments, ",") {
for _, v := range strings.Split(r.Departments, ",") { if v != "请选择部门信息" {
if v != "请选择部门信息" { depts += v + ","
depts += v + "," }
} }
} for _, j := range r.DepartmentId {
for _, j := range r.DepartmentId { if j != 0 {
if j != 0 { deptids = append(deptids, j)
deptids = append(deptids, j)
}
} }
} }
// fmt.Println(depts, deptids)
// 拼装新的用户信息 // 拼装新的用户信息
user := model.User{ user := model.User{