From d00d6df8a114e0d4378dffeadf2c8f602b9dd13d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E4=B8=AB=E8=AE=B2=E6=A2=B5?= Date: Wed, 15 Nov 2023 23:32:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=9A=84=E9=80=BB=E8=BE=91bug=20(#282)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logic/user_logic.go | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/logic/user_logic.go b/logic/user_logic.go index 1e3f55e..d5850c7 100644 --- a/logic/user_logic.go +++ b/logic/user_logic.go @@ -217,23 +217,21 @@ func (l UserLogic) Update(c *gin.Context, req interface{}) (data interface{}, rs return nil, tools.NewMySqlError(err) } + // 过滤掉前端会选择到的 请选择部门信息 这个选项 var ( depts string deptids []uint ) - if strings.Contains(r.Departments, "请选择部门信息") { - for _, v := range strings.Split(r.Departments, ",") { - if v != "请选择部门信息" { - depts += v + "," - } - } - for _, j := range r.DepartmentId { - if j != 0 { - deptids = append(deptids, j) - } + for _, v := range strings.Split(r.Departments, ",") { + if v != "请选择部门信息" { + depts += v + "," + } + } + for _, j := range r.DepartmentId { + if j != 0 { + deptids = append(deptids, j) } } - // fmt.Println(depts, deptids) // 拼装新的用户信息 user := model.User{