Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
9cb514ca75
|
@ -185,6 +185,22 @@ func (t *FsProductTemplateV2Model) FindAllByProductIdsTemplateTag(ctx context.Co
|
|||
err = db.Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// 获取开启云渲染的模板列表
|
||||
func (t *FsProductTemplateV2Model) FindAllCloudRenderTemplateByProductIdsTemplateTag(ctx context.Context, productIds []int64, templateTag string, sort string, fields ...string) (resp []FsProductTemplateV2, err error) {
|
||||
if len(productIds) == 0 {
|
||||
return
|
||||
}
|
||||
db := t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`product_id` in (?) and `template_tag` = ? and `is_del` = ? and `status` = ? and `element_model_id` > ? ", productIds, templateTag, 0, 1, 0)
|
||||
if sort != "" {
|
||||
db = db.Order(sort)
|
||||
}
|
||||
if len(fields) != 0 {
|
||||
db = db.Select(fields[0])
|
||||
}
|
||||
err = db.Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
func (t *FsProductTemplateV2Model) FindAllByFittingIds(ctx context.Context, fittingIds []int64, fields ...string) (resp []FsProductTemplateV2, err error) {
|
||||
db := t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`model_id` in(?) and `status` = ? and `is_del` = ? ", fittingIds, 1, 0)
|
||||
if len(fields) != 0 {
|
||||
|
|
|
@ -68,7 +68,27 @@ func (l *CreateLdapOrganizationLogic) CreateLdapOrganization(req *types.CreateLd
|
|||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "创建组织失败,"+err.Error())
|
||||
}
|
||||
return resp.SetStatus(basic.CodeOK)
|
||||
user, err := l.svcCtx.Ldap.GetLdapUserInfo(req.OwnerDN)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "获取负责人信息失败,"+err.Error())
|
||||
}
|
||||
if user.Status != 1 {
|
||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "负责人状态不正常")
|
||||
}
|
||||
//用户加入的部门
|
||||
user.OrganizationDNList = append(user.OrganizationDNList, organizationDN)
|
||||
//用户管理的部门
|
||||
user.ManageOrganizationDNList = append(user.ManageOrganizationDNList, organizationDN)
|
||||
//更新用户信息
|
||||
err = l.svcCtx.Ldap.Update(user.UserDN, map[string][]string{
|
||||
"departmentNumber": user.OrganizationDNList,
|
||||
"telexNumber": user.ManageOrganizationDNList,
|
||||
})
|
||||
if err != nil {
|
||||
return resp.SetStatusWithMessage(basic.CodeOK, "添加组织成功,但是设置负责人信息失败,"+err.Error())
|
||||
}
|
||||
return resp.SetStatusWithMessage(basic.CodeOK, "添加组织成功")
|
||||
}
|
||||
|
||||
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
|
||||
|
|
|
@ -88,7 +88,10 @@ func (l *CreateLdapUserLogic) CreateLdapUser(req *types.CreateLdapUserReq, r *ht
|
|||
"mail": {req.Email}, //邮箱
|
||||
"postalCode": {fmt.Sprintf("%d", req.Status)}, //状态
|
||||
"roomNumber": {fmt.Sprintf("%d", req.GroupId)}, //权限分组id
|
||||
"departmentNumber": req.OrganizationDNList, //所属组织部门
|
||||
"departmentNumber": {""}, //所属组织部门
|
||||
"telexNumber": {""}, //管理的部门
|
||||
"st": {fmt.Sprintf("%d", req.Gender)}, //性别
|
||||
"title": {req.Birthday}, //生日
|
||||
"postalAddress": {req.Avatar}, //头像
|
||||
"mobile": {req.Mobile}, //手机号
|
||||
"userPassword": {req.Password}, //密码
|
||||
|
@ -97,13 +100,6 @@ func (l *CreateLdapUserLogic) CreateLdapUser(req *types.CreateLdapUserReq, r *ht
|
|||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "添加用户失败,"+err.Error())
|
||||
}
|
||||
//将用户加入这些部门
|
||||
for _, v := range req.OrganizationDNList {
|
||||
if err = l.svcCtx.Ldap.AddUserToOrganization(v, userDN); err != nil {
|
||||
logx.Error("加入部门失败:", err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
return resp.SetStatusWithMessage(basic.CodeOK, "添加用户成功")
|
||||
}
|
||||
|
||||
|
|
|
@ -116,6 +116,8 @@ func (l *GetLdapOrganizationMembersLogic) GetLdapOrganizationMembers(req *types.
|
|||
Mobile: user.Mobile,
|
||||
Avatar: user.Avatar,
|
||||
EmployeeType: user.EmployeeType,
|
||||
Gender: user.Gender,
|
||||
Birthday: user.Birthday,
|
||||
Status: user.Status,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -54,8 +54,10 @@ func (l *GetLdapUserInfoLogic) GetLdapUserInfo(req *types.GetLdapUserInfoReq, r
|
|||
Email: user.Email,
|
||||
Mobile: user.Mobile,
|
||||
Avatar: user.Avatar,
|
||||
Status: user.Status,
|
||||
EmployeeTpye: user.EmployeeType,
|
||||
Gender: user.Gender,
|
||||
Birthday: user.Birthday,
|
||||
Status: user.Status,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -49,11 +49,42 @@ func (l *RemoveLdapOrganizationMemberLogic) RemoveLdapOrganizationMember(req *ty
|
|||
if !email.IsEmailValid(cnEmail) {
|
||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "错误的用户cn")
|
||||
}
|
||||
//获取组织成员列表
|
||||
err := l.svcCtx.Ldap.RemoveUserFromOrganization(req.OrganizationDN, req.UserDN)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "移除成员失败,"+err.Error())
|
||||
}
|
||||
//获取用户信息
|
||||
userInfo, err := l.svcCtx.Ldap.GetLdapUserInfo(req.UserDN)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "获取用户信息失败,"+err.Error())
|
||||
}
|
||||
//把属于的组织去掉
|
||||
newOrganizationDNList := make([]string, 0, len(userInfo.OrganizationDNList))
|
||||
for _, v := range userInfo.OrganizationDNList {
|
||||
if v == req.OrganizationDN {
|
||||
continue
|
||||
}
|
||||
newOrganizationDNList = append(newOrganizationDNList, v)
|
||||
}
|
||||
//如果是负责人也要把管理组织标识去掉
|
||||
newManageOrganizationDNList := make([]string, 0, len(userInfo.OrganizationDNList))
|
||||
for _, v := range userInfo.ManageOrganizationDNList {
|
||||
if v == req.OrganizationDN {
|
||||
continue
|
||||
}
|
||||
newManageOrganizationDNList = append(newManageOrganizationDNList, v)
|
||||
}
|
||||
err = l.svcCtx.Ldap.Update(req.UserDN, map[string][]string{
|
||||
"departmentNumber": newOrganizationDNList, //所属组织部门
|
||||
"telexNumber": newManageOrganizationDNList, //管理的部门
|
||||
})
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "移除成员成功,但更新用户信息失败")
|
||||
}
|
||||
return resp.SetStatusWithMessage(basic.CodeOK, "移除成员成功")
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,8 @@ func (l *UpdateLdapUserLogic) UpdateLdapUser(req *types.UpdateLdapUserReq, r *ht
|
|||
"postalAddress": {req.Avatar},
|
||||
"postalCode": {fmt.Sprintf("%d", req.Status)},
|
||||
"employeeType": {fmt.Sprintf("%d", req.EmployeeType)},
|
||||
"st": {fmt.Sprintf("%d", req.Gender)}, //性别
|
||||
"title": {req.Birthday}, //生日
|
||||
}
|
||||
err := l.svcCtx.Ldap.Update(req.UserDN, attr)
|
||||
if err != nil {
|
||||
|
|
|
@ -144,15 +144,16 @@ type UpdateLdapOrganizationReq struct {
|
|||
}
|
||||
|
||||
type CreateLdapUserReq struct {
|
||||
UserName string `json:"user_name"` //用户名
|
||||
Email string `json:"email"` //邮箱
|
||||
Password string `json:"password"` //密码
|
||||
Mobile string `json:"mobile"` //手机号
|
||||
Avatar string `json:"avatar"` //头像地址
|
||||
EmployeeType int64 `json:"employee_type,options=1|2|3"` //1正式 2实习 3外包
|
||||
GroupId int64 `json:"group_id,optional"` //授权分组id
|
||||
OrganizationDNList []string `json:"organization_dn_list"` //属于哪些部门
|
||||
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
|
||||
UserName string `json:"user_name"` //用户名
|
||||
Email string `json:"email"` //邮箱
|
||||
Password string `json:"password"` //密码
|
||||
Mobile string `json:"mobile"` //手机号
|
||||
Avatar string `json:"avatar"` //头像地址
|
||||
EmployeeType int64 `json:"employee_type,options=1|2|3"` //1正式 2实习 3外包
|
||||
GroupId int64 `json:"group_id,optional"` //授权分组id
|
||||
Gender int64 `json:"gender,options=1|2|3"` //性别 1男 2女 3未知
|
||||
Birthday string `json:"birthday"` //生日
|
||||
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
|
||||
}
|
||||
|
||||
type UpdateLdapUserReq struct {
|
||||
|
@ -163,6 +164,8 @@ type UpdateLdapUserReq struct {
|
|||
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
|
||||
EmployeeType int64 `json:"employee_type,options=1|2|3"` //1正式 2实习 3外包
|
||||
GroupId int64 `json:"group_id,optional"` //权限分组id
|
||||
Gender int64 `json:"gender,options=1|2|3"` //性别 1男 2女 3未知
|
||||
Birthday string `json:"birthday"` //生日
|
||||
}
|
||||
|
||||
type UpdateLdapUserPwdReq struct {
|
||||
|
@ -182,12 +185,14 @@ type GetLdapUserInfoReq struct {
|
|||
type GetLdapUserInfoRsp struct {
|
||||
UserId int64 `json:"user_id"`
|
||||
UserDN string `json:"user_dn"`
|
||||
UserName string `json:"user_name"` //用户名
|
||||
Email string `json:"email"` //邮箱
|
||||
Mobile string `json:"mobile"` //手机号
|
||||
Avatar string `json:"avatar"` //头像地址
|
||||
EmployeeTpye int64 `json:"employee_tpye"` //雇佣类型 1正式 2实习 3外包
|
||||
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
|
||||
UserName string `json:"user_name"` //用户名
|
||||
Email string `json:"email"` //邮箱
|
||||
Mobile string `json:"mobile"` //手机号
|
||||
Avatar string `json:"avatar"` //头像地址
|
||||
EmployeeTpye int64 `json:"employee_tpye"` //雇佣类型 1正式 2实习 3外包
|
||||
Gender int64 `json:"gender,options=1|2|3"` //性别 1男 2女 3未知
|
||||
Birthday string `json:"birthday"` //生日
|
||||
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
|
||||
}
|
||||
|
||||
type AddLdapOrganizationMemberReq struct {
|
||||
|
@ -211,12 +216,14 @@ type GetLdapOrganizationMembersRsp struct {
|
|||
type GetLdapOrganizationMembersItem struct {
|
||||
UserId int64 `json:"userId"`
|
||||
UserDN string `json:"user_dn"`
|
||||
UserName string `json:"user_name"` //用户名
|
||||
Email string `json:"email"` //邮箱
|
||||
Mobile string `json:"mobile"` //手机号
|
||||
Avatar string `json:"avatar"` //头像地址
|
||||
EmployeeType int64 `json:"employee_type"`
|
||||
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
|
||||
UserName string `json:"user_name"` //用户名
|
||||
Email string `json:"email"` //邮箱
|
||||
Mobile string `json:"mobile"` //手机号
|
||||
Avatar string `json:"avatar"` //头像地址
|
||||
EmployeeType int64 `json:"employee_type"` //雇佣类型
|
||||
Gender int64 `json:"gender,options=1|2|3"` //性别 1男 2女 3未知
|
||||
Birthday string `json:"birthday"` //生日
|
||||
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
|
||||
}
|
||||
|
||||
type GetLdapUsersReq struct {
|
||||
|
|
|
@ -57,12 +57,33 @@ func (l *GetProductModelsLogic) GetProductModels(req *types.GetProductModelsReq,
|
|||
if len(productList) != len(productIds) {
|
||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "some one product is invalid")
|
||||
}
|
||||
//获取产品所有的模型以及配件
|
||||
modelList, err := l.svcCtx.AllModels.FsProductModel3d.GetAllByProductIdsTags(l.ctx, productIds, []int{constants.TAG_MODEL, constants.TAG_PARTS})
|
||||
//根据模板标签获取开启了云渲染的模板列表
|
||||
templateList, err := l.svcCtx.AllModels.FsProductTemplateV2.FindAllCloudRenderTemplateByProductIdsTemplateTag(l.ctx, productIds, req.TemplateTag, "", "id,product_id,model_id")
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get product template list")
|
||||
}
|
||||
modelIds := make([]int64, 0, len(templateList))
|
||||
for _, v := range templateList {
|
||||
modelIds = append(modelIds, *v.ModelId)
|
||||
}
|
||||
//获取模型列表
|
||||
modelList, err := l.svcCtx.AllModels.FsProductModel3d.GetAllByIds(l.ctx, modelIds, "")
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get model list")
|
||||
}
|
||||
partIds := make([]int64, 0, len(modelList))
|
||||
for _, v := range modelList {
|
||||
if *v.PartId == 0 {
|
||||
continue
|
||||
}
|
||||
partIds = append(partIds, *v.PartId)
|
||||
}
|
||||
//获取配件列表
|
||||
partList, err := l.svcCtx.AllModels.FsProductModel3d.GetAllByIds(l.ctx, partIds, "")
|
||||
//合并模型和配件
|
||||
modelList = append(modelList, partList...)
|
||||
mapProductModels := make(map[int64][]types.ModelItem)
|
||||
lightIds := make([]int64, 0, len(modelList))
|
||||
for _, v := range modelList {
|
||||
|
|
|
@ -172,7 +172,8 @@ type TemplateTagColorInfo struct {
|
|||
}
|
||||
|
||||
type GetProductModelsReq struct {
|
||||
ProductIds string `form:"product_ids"`
|
||||
ProductIds string `form:"product_ids"`
|
||||
TemplateTag string `form:"template_tag,optional"`
|
||||
}
|
||||
|
||||
type ProductItem struct {
|
||||
|
|
|
@ -140,6 +140,11 @@ func (w *wsConnectItem) consumeRenderImageData() {
|
|||
|
||||
// 执行渲染任务
|
||||
func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageReqMsg) {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
logx.Error("render image panic!!!!!!")
|
||||
}
|
||||
}()
|
||||
if renderImageData.RenderData.Logo == "" {
|
||||
w.renderErrResponse(renderImageData.RequestId, renderImageData.RenderData.TemplateTag, "", "请传入logo", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0)
|
||||
return
|
||||
|
@ -168,22 +173,6 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe
|
|||
w.renderErrResponse(renderImageData.RequestId, renderImageData.RenderData.TemplateTag, "", "选择的模板标签颜色索引越界", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0)
|
||||
return
|
||||
}
|
||||
//获取产品信息(部分字段)
|
||||
productInfo, err := w.logic.svcCtx.AllModels.FsProduct.FindOne(w.logic.ctx, renderImageData.RenderData.ProductId, "id,is_customization")
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
w.renderErrResponse(renderImageData.RequestId, renderImageData.RenderData.TemplateTag, "", "该产品不存在", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0)
|
||||
return
|
||||
}
|
||||
w.renderErrResponse(renderImageData.RequestId, renderImageData.RenderData.TemplateTag, "", "获取产品失败", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0)
|
||||
logx.Error(err)
|
||||
return
|
||||
}
|
||||
//不可定制
|
||||
if *productInfo.IsCustomization == 0 {
|
||||
w.renderErrResponse(renderImageData.RequestId, renderImageData.RenderData.TemplateTag, "", "该产品不可定制", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0)
|
||||
return
|
||||
}
|
||||
//获取信息
|
||||
productSize, productTemplate, model3dInfo, switchInfo, err := w.getProductRelationInfo(&renderImageData)
|
||||
if err != nil {
|
||||
|
@ -292,15 +281,8 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe
|
|||
taskId := w.genRenderTaskId(combineImage, renderImageData, model3dInfo, productTemplate, element)
|
||||
//查询有没有缓存的资源,有就返回
|
||||
resource, err := w.logic.svcCtx.AllModels.FsResource.FindOneById(w.logic.ctx, taskId)
|
||||
if err != nil {
|
||||
if !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
w.renderErrResponse(renderImageData.RequestId, renderImageData.RenderData.TemplateTag, taskId, "获取unity云渲染缓存失败", renderImageData.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
logx.Error("failed to find render resource:", err)
|
||||
return
|
||||
}
|
||||
//无缓存
|
||||
logx.Info("无缓存的渲染图,需要unity")
|
||||
} else { //有缓存
|
||||
switch err {
|
||||
case nil: //有缓存
|
||||
//如果没有debug或者debug模式下开启了缓存则返回缓存
|
||||
if w.debug == nil || w.debug.IsCache == 1 {
|
||||
//返回给客户端
|
||||
|
@ -316,6 +298,12 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe
|
|||
return
|
||||
}
|
||||
//否则继续去unity
|
||||
default: //无缓存
|
||||
if !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
w.renderErrResponse(renderImageData.RequestId, renderImageData.RenderData.TemplateTag, taskId, "获取unity云渲染缓存失败", renderImageData.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId)
|
||||
logx.Error("failed to find render resource:", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
//组装数据
|
||||
if err = w.assembleRenderDataToUnity(taskId, resolution, combineImage, renderImageData, productTemplate, model3dInfo, element, productSize); err != nil {
|
||||
|
|
|
@ -228,15 +228,16 @@ type UpdateLdapOrganizationReq {
|
|||
}
|
||||
//添加ldap用户帐号
|
||||
type CreateLdapUserReq {
|
||||
UserName string `json:"user_name"` //用户名
|
||||
Email string `json:"email"` //邮箱
|
||||
Password string `json:"password"` //密码
|
||||
Mobile string `json:"mobile"` //手机号
|
||||
Avatar string `json:"avatar"` //头像地址
|
||||
EmployeeType int64 `json:"employee_type,options=1|2|3"` //1正式 2实习 3外包
|
||||
GroupId int64 `json:"group_id,optional"` //授权分组id
|
||||
OrganizationDNList []string `json:"organization_dn_list"` //属于哪些部门
|
||||
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
|
||||
UserName string `json:"user_name"` //用户名
|
||||
Email string `json:"email"` //邮箱
|
||||
Password string `json:"password"` //密码
|
||||
Mobile string `json:"mobile"` //手机号
|
||||
Avatar string `json:"avatar"` //头像地址
|
||||
EmployeeType int64 `json:"employee_type,options=1|2|3"` //1正式 2实习 3外包
|
||||
GroupId int64 `json:"group_id,optional"` //授权分组id
|
||||
Gender int64 `json:"gender,options=1|2|3"` //性别 1男 2女 3未知
|
||||
Birthday string `json:"birthday"` //生日
|
||||
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
|
||||
}
|
||||
//修改ldap用户信息
|
||||
type UpdateLdapUserReq {
|
||||
|
@ -247,6 +248,8 @@ type UpdateLdapUserReq {
|
|||
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
|
||||
EmployeeType int64 `json:"employee_type,options=1|2|3"` //1正式 2实习 3外包
|
||||
GroupId int64 `json:"group_id,optional"` //权限分组id
|
||||
Gender int64 `json:"gender,options=1|2|3"` //性别 1男 2女 3未知
|
||||
Birthday string `json:"birthday"` //生日
|
||||
}
|
||||
//修改用户密码
|
||||
type UpdateLdapUserPwdReq {
|
||||
|
@ -265,12 +268,14 @@ type GetLdapUserInfoReq {
|
|||
type GetLdapUserInfoRsp {
|
||||
UserId int64 `json:"user_id"`
|
||||
UserDN string `json:"user_dn"`
|
||||
UserName string `json:"user_name"` //用户名
|
||||
Email string `json:"email"` //邮箱
|
||||
Mobile string `json:"mobile"` //手机号
|
||||
Avatar string `json:"avatar"` //头像地址
|
||||
EmployeeTpye int64 `json:"employee_tpye"` //雇佣类型 1正式 2实习 3外包
|
||||
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
|
||||
UserName string `json:"user_name"` //用户名
|
||||
Email string `json:"email"` //邮箱
|
||||
Mobile string `json:"mobile"` //手机号
|
||||
Avatar string `json:"avatar"` //头像地址
|
||||
EmployeeTpye int64 `json:"employee_tpye"` //雇佣类型 1正式 2实习 3外包
|
||||
Gender int64 `json:"gender,options=1|2|3"` //性别 1男 2女 3未知
|
||||
Birthday string `json:"birthday"` //生日
|
||||
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
|
||||
}
|
||||
//ldap组织添加成员
|
||||
type AddLdapOrganizationMemberReq {
|
||||
|
@ -292,12 +297,14 @@ type GetLdapOrganizationMembersRsp {
|
|||
type GetLdapOrganizationMembersItem {
|
||||
UserId int64 `json:"userId"`
|
||||
UserDN string `json:"user_dn"`
|
||||
UserName string `json:"user_name"` //用户名
|
||||
Email string `json:"email"` //邮箱
|
||||
Mobile string `json:"mobile"` //手机号
|
||||
Avatar string `json:"avatar"` //头像地址
|
||||
EmployeeType int64 `json:"employee_type"`
|
||||
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
|
||||
UserName string `json:"user_name"` //用户名
|
||||
Email string `json:"email"` //邮箱
|
||||
Mobile string `json:"mobile"` //手机号
|
||||
Avatar string `json:"avatar"` //头像地址
|
||||
EmployeeType int64 `json:"employee_type"` //雇佣类型
|
||||
Gender int64 `json:"gender,options=1|2|3"` //性别 1男 2女 3未知
|
||||
Birthday string `json:"birthday"` //生日
|
||||
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
|
||||
}
|
||||
//获取基础用户组中成员列表
|
||||
type GetLdapUsersReq {
|
||||
|
|
|
@ -190,7 +190,8 @@ type TemplateTagColorInfo {
|
|||
}
|
||||
//根据产品获取模型配件列表
|
||||
type GetProductModelsReq {
|
||||
ProductIds string `form:"product_ids"`
|
||||
ProductIds string `form:"product_ids"`
|
||||
TemplateTag string `form:"template_tag,optional"`
|
||||
}
|
||||
type ProductItem {
|
||||
ModelList []ModelItem `json:"model_list"`
|
||||
|
|
|
@ -9,17 +9,20 @@ import (
|
|||
)
|
||||
|
||||
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外包
|
||||
GroupId int64 `json:"group_id"` //权限组id
|
||||
OrganizationDNList []string `json:"organization_dn_list"` //加入的部门
|
||||
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外包
|
||||
GroupId int64 `json:"group_id"` //权限组id
|
||||
OrganizationDNList []string `json:"organization_dn_list"` //加入的部门
|
||||
ManageOrganizationDNList []string `json:"manage_organization_dn_list"` //管理的部门
|
||||
Gender int64 `json:"gender"` //性别
|
||||
Birthday string `json:"birthday"` //生日
|
||||
Status int64 `json:"status,options=0|1"` //状态 1正常0离职
|
||||
}
|
||||
|
||||
// 获取用户详情
|
||||
|
@ -87,6 +90,18 @@ func (l *Ldap) GetLdapUserInfo(userDN string) (*LdapUserInfo, error) {
|
|||
}
|
||||
case "departmentNumber": //加入的部门dn集合
|
||||
user.OrganizationDNList = attr.Values
|
||||
case "telexNumber": //管理的部门dn集合
|
||||
user.ManageOrganizationDNList = attr.Values
|
||||
case "st": //性别
|
||||
if len(attr.Values) == 0 {
|
||||
return nil, errors.New("性别不存在")
|
||||
}
|
||||
user.Gender, err = strconv.ParseInt(attr.Values[0], 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case "title": //生日
|
||||
user.Birthday = strings.Join(attr.Values, ",")
|
||||
}
|
||||
}
|
||||
if user.UserId == 0 {
|
||||
|
@ -156,6 +171,18 @@ func (l *Ldap) GetLdapBaseTeamUserList(pageSize uint32, filter, pageCookie strin
|
|||
}
|
||||
case "departmentNumber": //加入的部门dn集合
|
||||
user.OrganizationDNList = attr.Values
|
||||
case "telexNumber": //管理的部门dn集合
|
||||
user.ManageOrganizationDNList = attr.Values
|
||||
case "st": //性别
|
||||
if len(attr.Values) == 0 {
|
||||
return nil, "", errors.New("性别不存在")
|
||||
}
|
||||
user.Gender, err = strconv.ParseInt(attr.Values[0], 10, 64)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
case "title": //生日
|
||||
user.Birthday = strings.Join(attr.Values, ",")
|
||||
}
|
||||
}
|
||||
list = append(list, user)
|
||||
|
@ -219,6 +246,28 @@ func (l *Ldap) GetLdapBaseTeamUsersByParams(filter string) ([]LdapUserInfo, erro
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case "roomNumber": //权限组id
|
||||
if len(attr.Values) == 0 {
|
||||
return nil, errors.New("权限组id不存在")
|
||||
}
|
||||
user.GroupId, err = strconv.ParseInt(attr.Values[0], 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case "departmentNumber": //加入的部门dn集合
|
||||
user.OrganizationDNList = attr.Values
|
||||
case "telexNumber": //管理的部门dn集合
|
||||
user.ManageOrganizationDNList = attr.Values
|
||||
case "st": //性别
|
||||
if len(attr.Values) == 0 {
|
||||
return nil, errors.New("性别不存在")
|
||||
}
|
||||
user.Gender, err = strconv.ParseInt(attr.Values[0], 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case "title": //生日
|
||||
user.Birthday = strings.Join(attr.Values, ",")
|
||||
}
|
||||
}
|
||||
list = append(list, user)
|
||||
|
|
Loading…
Reference in New Issue
Block a user