This commit is contained in:
laodaming 2023-11-21 11:59:10 +08:00
parent 297dffcbc0
commit cbbc5e0ff1
5 changed files with 15 additions and 58 deletions

View File

@ -99,8 +99,8 @@ func (l *GetLdapOrganizationMembersLogic) GetLdapOrganizationMembers(req *types.
Avatar: user.Avatar,
EmployeeType: user.EmployeeType,
Status: user.Status,
CreateTime: user.CreateTime.Format("2006-01-02 15:04:05"),
UpdateTime: user.UpdateTime.Format("2006-01-02 15:04:05"),
//CreateTime: user.CreateTime.Format("2006-01-02 15:04:05"),
//UpdateTime: user.UpdateTime.Format("2006-01-02 15:04:05"),
})
}
return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetLdapOrganizationMembersRsp{

View File

@ -54,8 +54,8 @@ func (l *GetLdapUserInfoLogic) GetLdapUserInfo(req *types.GetLdapUserInfoReq, us
Avatar: user.Avatar,
Status: user.Status,
EmployeeTpye: user.EmployeeType,
CreateTime: user.CreateTime.Format("2006-01-02 15:04:05"),
UpdateTime: user.UpdateTime.Format("2006-01-02 15:04:05"),
//CreateTime: user.CreateTime.Format("2006-01-02 15:04:05"),
//UpdateTime: user.UpdateTime.Format("2006-01-02 15:04:05"),
})
}

View File

@ -52,8 +52,8 @@ func (l *GetLdapUsersLogic) GetLdapUsers(req *types.GetLdapUsersReq, userinfo *a
Avatar: v.Avatar,
EmployeeType: v.EmployeeType,
Status: v.Status,
CreateTime: v.CreateTime.Format("2006-01-02 15:04:05"),
UpdateTime: v.UpdateTime.Format("2006-01-02 15:04:05"),
//CreateTime: v.CreateTime.Format("2006-01-02 15:04:05"),
//UpdateTime: v.UpdateTime.Format("2006-01-02 15:04:05"),
})
}
return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetLdapUsersRsp{

View File

@ -1,10 +0,0 @@
package ldap_lib
import (
"time"
)
func LdapTimeToTime(timeStr string) (time.Time, error) {
// 将时间字符串转换为时间
return time.Parse("20060102150405Z", timeStr)
}

View File

@ -6,21 +6,18 @@ import (
"github.com/go-ldap/ldap/v3"
"strconv"
"strings"
"time"
)
type LdapUserInfo 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"` //头像地址
EmployeeType int64 `json:"employee_type"` //1正式 2实习 3外包
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
CreateTime time.Time `json:"create_time"`
UpdateTime time.Time `json:"update_time"`
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离职
}
// 获取用户详情
@ -74,16 +71,6 @@ func (l *Ldap) GetLdapUserInfo(userDN string) (*LdapUserInfo, error) {
if err != nil {
return nil, err
}
case "createTimestamp":
user.CreateTime, err = LdapTimeToTime(attr.Values[0])
if err != nil {
return nil, err
}
case "modifyTimestamp":
user.UpdateTime, err = LdapTimeToTime(attr.Values[0])
if err != nil {
return nil, err
}
}
}
break
@ -145,16 +132,6 @@ func (l *Ldap) GetLdapBaseTeamUserList(pageSize uint32, pageCookie string) ([]Ld
if err != nil {
return nil, "", err
}
case "createTimestamp":
user.CreateTime, err = LdapTimeToTime(attr.Values[0])
if err != nil {
return nil, "", err
}
case "modifyTimestamp":
user.UpdateTime, err = LdapTimeToTime(attr.Values[0])
if err != nil {
return nil, "", err
}
}
}
list = append(list, user)
@ -218,16 +195,6 @@ func (l *Ldap) GetLdapBaseTeamUsersByParams(filter string) ([]LdapUserInfo, erro
if err != nil {
return nil, err
}
case "createTimestamp":
user.CreateTime, err = LdapTimeToTime(attr.Values[0])
if err != nil {
return nil, err
}
case "modifyTimestamp":
user.UpdateTime, err = LdapTimeToTime(attr.Values[0])
if err != nil {
return nil, err
}
}
}
list = append(list, user)