Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Aug 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions logic/a_logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.Mobile == "" {
user.Mobile = "该用户手机号为空"
}
if user.Introduction == "" {
user.Introduction = user.Nickname
if user.PostalAddress == "" {
user.PostalAddress = "默认:地球"
}
if user.JobNumber == "" {
user.JobNumber = user.Mobile
if user.Mobile == "" {
user.Mobile = "emptyMobile"
}

// 先将用户添加到MySQL
err := isql.User.Add(user)
if err != nil {
Expand Down