Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop

This commit is contained in:
momo
2023-11-20 14:34:18 +08:00
10 changed files with 90 additions and 63 deletions

View File

@@ -9,14 +9,15 @@ import (
)
type GetLdapUserInfoRsp struct {
UserId int64 `json:"userId"`
UserDN string `json:"user_dn"`
UserName string `json:"user_name"` //用户名
Password string `json:"password"` //密码
Email string `json:"email"` //邮箱
Mobile string `json:"mobile"` //手机号
Avatar string `json:"avatar"` //头像地址
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
UserId int64 `json:"userId"`
UserDN string `json:"user_dn"`
UserName string `json:"user_name"` //用户名
Password string `json:"password"` //密码
Email string `json:"email"` //邮箱
Mobile string `json:"mobile"` //手机号
Avatar string `json:"avatar"` //头像地址
EmployeeType int64 `json:"employee_type"` //1正式 2实习 3外包
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
}
func (l *Ldap) GetLdapUserInfo(userDN string) (*GetLdapUserInfoRsp, error) {
@@ -54,6 +55,14 @@ func (l *Ldap) GetLdapUserInfo(userDN string) (*GetLdapUserInfoRsp, error) {
user.Avatar = strings.Join(attr.Values, "")
case "userPassword": //密码
user.Password = strings.Join(attr.Values, ",")
case "employeeType": //员工类型
if len(attr.Values) == 0 {
continue
}
user.EmployeeType, err = strconv.ParseInt(attr.Values[0], 10, 64)
if err != nil {
return nil, errors.New("用户类型转数字失败")
}
case "postalCode": //状态
if len(attr.Values) == 0 {
continue