🐡 fix: empty mobile 占位字符问题 (#107)
This commit is contained in:
parent
90e6f5cc5d
commit
a09a56630b
|
@ -82,27 +82,35 @@ func CommonUpdateGroup(oldGroup, newGroup *model.Group) error {
|
||||||
|
|
||||||
// CommonAddUser 标准创建用户
|
// CommonAddUser 标准创建用户
|
||||||
func CommonAddUser(user *model.User, groups []*model.Group) error {
|
func CommonAddUser(user *model.User, groups []*model.Group) error {
|
||||||
if user.Departments == "" {
|
// 用户信息的预置处理
|
||||||
user.Departments = "默认:研发中心"
|
if user.Nickname == "" {
|
||||||
|
user.Nickname = "佚名"
|
||||||
}
|
}
|
||||||
if user.GivenName == "" {
|
if user.GivenName == "" {
|
||||||
user.GivenName = user.Nickname
|
user.GivenName = user.Nickname
|
||||||
}
|
}
|
||||||
if user.PostalAddress == "" {
|
if user.Introduction == "" {
|
||||||
user.PostalAddress = "默认:地球"
|
user.Introduction = user.Nickname
|
||||||
|
}
|
||||||
|
if user.Mail == "" {
|
||||||
|
user.Mail = "该用户邮箱为空"
|
||||||
|
}
|
||||||
|
if user.JobNumber == "" {
|
||||||
|
user.JobNumber = "该用户工号为空"
|
||||||
|
}
|
||||||
|
if user.Departments == "" {
|
||||||
|
user.Departments = "默认:研发中心"
|
||||||
}
|
}
|
||||||
if user.Position == "" {
|
if user.Position == "" {
|
||||||
user.Position = "默认:技术"
|
user.Position = "默认:技术"
|
||||||
}
|
}
|
||||||
|
if user.PostalAddress == "" {
|
||||||
|
user.PostalAddress = "默认:地球"
|
||||||
|
}
|
||||||
if user.Mobile == "" {
|
if user.Mobile == "" {
|
||||||
user.Mobile = "该用户手机号为空"
|
user.Mobile = "emptyMobile"
|
||||||
}
|
|
||||||
if user.Introduction == "" {
|
|
||||||
user.Introduction = user.Nickname
|
|
||||||
}
|
|
||||||
if user.JobNumber == "" {
|
|
||||||
user.JobNumber = user.Mobile
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 先将用户添加到MySQL
|
// 先将用户添加到MySQL
|
||||||
err := isql.User.Add(user)
|
err := isql.User.Add(user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue