feat:完善信息,增加socket
This commit is contained in:
@ -2,14 +2,9 @@ package manage
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/app/session"
|
||||
config2 "SciencesServer/config"
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Company 公司信息
|
||||
@ -102,53 +97,6 @@ func (c *Company) Product(id uint64, page, pageSize int) ([]*CompanyProductInfo,
|
||||
return list, nil
|
||||
}
|
||||
|
||||
// Match 匹配信息
|
||||
func (c *Company) Match(title string, industrys, keywords []string) (*controller.ReturnPages, error) {
|
||||
params := strings.Join([]string{
|
||||
title, strings.Join(industrys, ","), strings.Join(keywords, ","),
|
||||
}, ",")
|
||||
manage := service.NewESManage(
|
||||
service.WithManageIdentity(config.TenantUserIdentityForCompany),
|
||||
)
|
||||
out, count, err := manage.Search(0, 0, map[string]interface{}{
|
||||
"title": params, "industry": params, "keyword": params, "research": params,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ids := make([]uint64, 0)
|
||||
|
||||
for _, v := range out.([]interface{}) {
|
||||
val := v.(*service.ESManage)
|
||||
ids = append(ids, val.ID)
|
||||
}
|
||||
mManageCompany := model.NewManageCompany()
|
||||
|
||||
companys := make([]*model2.ManageCompany, 0)
|
||||
|
||||
if err := model2.ScanFields(mManageCompany.ManageCompany, &companys, []string{"id", "kind", "name", "image", "url", "keyword"},
|
||||
&model2.ModelWhereOrder{
|
||||
Where: model2.NewWhereIn("id", ids),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("examine_status", model2.ExamineStatusForAgree),
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := make([]*CompanyMatchInfo, 0)
|
||||
|
||||
for _, v := range companys {
|
||||
list = append(list, &CompanyMatchInfo{
|
||||
ID: v.GetEncodeID(), Kind: v.Kind, Name: v.Name,
|
||||
Image: v.Image.Analysis(config2.SystemConfig[config2.SysImageDomain]),
|
||||
Url: v.Url,
|
||||
Keywords: v.GetKeywordAttribute(),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
func NewCompany() CompanyHandle {
|
||||
return func(session *session.Enterprise) *Company {
|
||||
return &Company{
|
||||
|
Reference in New Issue
Block a user