feat:优化项目信息

This commit is contained in:
henry
2021-12-01 14:12:23 +08:00
parent c27e115517
commit 3abfe92add
32 changed files with 397 additions and 429 deletions

View File

@ -3,10 +3,8 @@ package identity
import (
"SciencesServer/app/api/enterprise/model"
"SciencesServer/app/api/manage/controller"
"SciencesServer/app/basic/config"
model2 "SciencesServer/app/common/model"
"SciencesServer/app/session"
"strings"
)
type Instance struct {
@ -19,15 +17,14 @@ type InstanceHandle func(session *session.Enterprise, local string) *Instance
type (
// InstanceForExpert 专家信息
InstanceForExpert struct {
*model.UserManageForExpert
ID string `json:"id"`
Industry string `json:"industry"`
ID string `json:"id"`
*model.UserIdentityForExpert
}
)
// Expert 专家列表
func (c *Instance) Expert(name, mobile string, page, pageSize int) (*controller.ReturnPages, error) {
mUserManage := model.NewUserManage()
mUserIdentity := model.NewUserIdentity()
where := make([]*model2.ModelWhere, 0)
@ -39,7 +36,7 @@ func (c *Instance) Expert(name, mobile string, page, pageSize int) (*controller.
}
var count int64
out, err := mUserManage.Expert(page, pageSize, &count, where...)
out, err := mUserIdentity.Expert(page, pageSize, &count, where...)
if err != nil {
return nil, err
@ -48,16 +45,10 @@ func (c *Instance) Expert(name, mobile string, page, pageSize int) (*controller.
list := make([]*InstanceForExpert, 0)
for _, v := range out {
mUserManage.ID = v.ID
mUserManage.IdentityInfo = v.IdentityInfo
obj := mUserManage.GetIdentityInfoAttribute().(*model2.UserIdentityForExpert)
industry := make([]string, 0)
mUserIdentity.ID = v.ID
for _, v := range strings.Split(obj.Industry, ";") {
industry = append(industry, config.GetIndustryInfo(v, "-"))
}
list = append(list, &InstanceForExpert{
UserManageForExpert: v, ID: mUserManage.GetEncodeID(), Industry: strings.Join(industry, ""),
ID: mUserIdentity.GetEncodeID(), UserIdentityForExpert: v,
})
}
return &controller.ReturnPages{Data: list, Count: count}, nil