🐡 fix: empty mobile 占位字符问题 (#107)

This commit is contained in:
二丫讲梵 2022-08-06 11:23:40 +08:00 committed by GitHub
parent 90e6f5cc5d
commit a09a56630b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 11 deletions

View File

@ -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 {