feat:优化信息,完善es查询,完善网站首页公司信息查询
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
config2 "SciencesServer/config"
|
||||
"errors"
|
||||
)
|
||||
|
||||
@ -27,6 +28,7 @@ var searchIdentityHandle = map[int]func(ids []uint64) (interface{}, error){
|
||||
config.TenantUserIdentityForAgent: company,
|
||||
}
|
||||
|
||||
// company 公司信息
|
||||
func company(ids []uint64) (interface{}, error) {
|
||||
mManageCompany := model.NewManageCompany()
|
||||
out := make([]*model2.ManageCompany, 0)
|
||||
@ -39,7 +41,17 @@ func company(ids []uint64) (interface{}, error) {
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
list := make([]*CompanyBasicInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &CompanyBasicInfo{
|
||||
ID: v.GetEncodeID(), Kind: v.Kind, Name: v.Name,
|
||||
Image: v.Image.Analysis(config2.SettingInfo.Domain),
|
||||
Url: v.Url,
|
||||
Keywords: v.GetKeywordAttribute(),
|
||||
})
|
||||
}
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func expert(ids []uint64) (interface{}, error) {
|
||||
@ -87,20 +99,24 @@ func laboratory(ids []uint64) (interface{}, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *Search) Launch(identity int, params string) (interface{}, error) {
|
||||
manage := service.NewManage()
|
||||
|
||||
_params := map[string]interface{}{
|
||||
"title": params, "keyword": params, "research": params,
|
||||
}
|
||||
data, err := manage.Search(1, 1, _params)
|
||||
func (c *Search) Launch(identity int, param, industry string, page, pageSize int) (interface{}, error) {
|
||||
manage := service.NewESManage(
|
||||
service.WithManageIdentity(identity),
|
||||
service.WithManageTitle(param),
|
||||
service.WithManageIndustry(industry),
|
||||
service.WithManageKeyword(param),
|
||||
service.WithManageResearch(param),
|
||||
)
|
||||
out, err := manage.Search(page, pageSize)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if out == nil {
|
||||
return nil, nil
|
||||
}
|
||||
ids := make([]uint64, 0)
|
||||
|
||||
for _, v := range data.([]*service.Manage) {
|
||||
for _, v := range out.([]*service.ESManage) {
|
||||
if v.Identity != identity {
|
||||
continue
|
||||
}
|
||||
|
Reference in New Issue
Block a user