From a09a56630b0eb642562ba77607d06d8dfc4289cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E4=B8=AB=E8=AE=B2=E6=A2=B5?= Date: Sat, 6 Aug 2022 11:23:40 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=A1=20fix:=20empty=20mobile=20?= =?UTF-8?q?=E5=8D=A0=E4=BD=8D=E5=AD=97=E7=AC=A6=E9=97=AE=E9=A2=98=20(#107)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logic/a_logic.go | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/logic/a_logic.go b/logic/a_logic.go index 93d9b1d..8b4e155 100644 --- a/logic/a_logic.go +++ b/logic/a_logic.go @@ -82,27 +82,35 @@ func CommonUpdateGroup(oldGroup, newGroup *model.Group) error { // CommonAddUser 标准创建用户 func CommonAddUser(user *model.User, groups []*model.Group) error { - if user.Departments == "" { - user.Departments = "默认:研发中心" + // 用户信息的预置处理 + if user.Nickname == "" { + user.Nickname = "佚名" } if user.GivenName == "" { user.GivenName = user.Nickname } - if user.PostalAddress == "" { - user.PostalAddress = "默认:地球" + if user.Introduction == "" { + user.Introduction = user.Nickname + } + if user.Mail == "" { + user.Mail = "该用户邮箱为空" + } + if user.JobNumber == "" { + user.JobNumber = "该用户工号为空" + } + if user.Departments == "" { + user.Departments = "默认:研发中心" } if user.Position == "" { user.Position = "默认:技术" } + if user.PostalAddress == "" { + user.PostalAddress = "默认:地球" + } if user.Mobile == "" { - user.Mobile = "该用户手机号为空" - } - if user.Introduction == "" { - user.Introduction = user.Nickname - } - if user.JobNumber == "" { - user.JobNumber = user.Mobile + user.Mobile = "emptyMobile" } + // 先将用户添加到MySQL err := isql.User.Add(user) if err != nil {