feat:完善项目信息
This commit is contained in:
@ -59,7 +59,7 @@ func (*ES) Search(c *gin.Context) {
|
||||
// service.WithPatentTitle(form.Param),
|
||||
// service.WithPatentIndustry(form.Industry),
|
||||
//)
|
||||
data, err := manage.Search(1, 10, nil)
|
||||
data, _, err := manage.Search(1, 10, nil)
|
||||
|
||||
for _, v := range data.([]interface{}) {
|
||||
fmt.Println(reflect.TypeOf(v).String())
|
||||
|
||||
@ -11,7 +11,7 @@ type Search struct{}
|
||||
func (*Search) Launch(c *gin.Context) {
|
||||
form := &struct {
|
||||
Mode int `json:"mode" form:"mode" binding:"required"`
|
||||
Keyword string `json:"keyword" form:"keyword" binding:"required"`
|
||||
Keyword string `json:"keyword" form:"keyword"`
|
||||
Industry string `json:"industry" form:"industry"`
|
||||
Params map[string]interface{} `json:"params" form:"params"`
|
||||
api.PageForm
|
||||
|
||||
@ -3,6 +3,7 @@ package manage
|
||||
import (
|
||||
"SciencesServer/app/api/website/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
config2 "SciencesServer/config"
|
||||
@ -103,7 +104,7 @@ func laboratory(ids []uint64) (interface{}, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *Search) Launch(identity int, param, industry string, page, pageSize int) (interface{}, error) {
|
||||
func (c *Search) Launch(identity int, param, industry string, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
manage := service.NewESManage(
|
||||
service.WithManageIdentity(identity),
|
||||
service.WithManageTitle(param),
|
||||
@ -111,7 +112,7 @@ func (c *Search) Launch(identity int, param, industry string, page, pageSize int
|
||||
service.WithManageKeyword(param),
|
||||
service.WithManageResearch(param),
|
||||
)
|
||||
out, err := manage.Search(page, pageSize, nil)
|
||||
out, count, err := manage.Search(page, pageSize, nil)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -129,7 +130,12 @@ func (c *Search) Launch(identity int, param, industry string, page, pageSize int
|
||||
if !has {
|
||||
return nil, errors.New("操作错误,未知的身份信息")
|
||||
}
|
||||
return handle(ids)
|
||||
var data interface{}
|
||||
|
||||
if data, err = handle(ids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &controller.ReturnPages{Data: data, Count: count}, nil
|
||||
}
|
||||
|
||||
func NewSearch() SearchHandle {
|
||||
|
||||
@ -3,6 +3,7 @@ package search
|
||||
import (
|
||||
"SciencesServer/app/api/website/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
config2 "SciencesServer/config"
|
||||
@ -18,7 +19,7 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
func achievementSearch(page, pageSize int, keyword, industry string, params map[string]interface{}) (interface{}, error) {
|
||||
func achievementSearch(page, pageSize int, keyword, industry string, params map[string]interface{}) (*controller.ReturnPages, error) {
|
||||
manage := service.NewESAchievement(
|
||||
service.WithAchievementTitle(keyword),
|
||||
service.WithAchievementKeyword(keyword),
|
||||
@ -26,7 +27,7 @@ func achievementSearch(page, pageSize int, keyword, industry string, params map[
|
||||
if industry != "" {
|
||||
service.WithAchievementIndustry(keyword)(manage)
|
||||
}
|
||||
out, err := manage.Search(page, pageSize)
|
||||
out, count, err := manage.Search(page, pageSize)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -65,5 +66,5 @@ func achievementSearch(page, pageSize int, keyword, industry string, params map[
|
||||
Industrys: _industrys, Keywords: v.GetKeywordAttribute(),
|
||||
})
|
||||
}
|
||||
return list, nil
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package search
|
||||
import (
|
||||
"SciencesServer/app/api/website/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
config2 "SciencesServer/config"
|
||||
@ -22,7 +23,7 @@ type (
|
||||
)
|
||||
|
||||
// searchCompany 公司搜索
|
||||
func searchCompany(page, pageSize int, keyword, industry string, params map[string]interface{}) (interface{}, error) {
|
||||
func searchCompany(page, pageSize int, keyword, industry string, params map[string]interface{}) (*controller.ReturnPages, error) {
|
||||
manage := service.NewESManage(
|
||||
service.WithManageIdentity(config.TenantUserIdentityForCompany),
|
||||
service.WithManageTitle(keyword),
|
||||
@ -32,7 +33,9 @@ func searchCompany(page, pageSize int, keyword, industry string, params map[stri
|
||||
if industry != "" {
|
||||
service.WithManageIndustry(industry)(manage)
|
||||
}
|
||||
out, err := manage.Search(page, pageSize, nil)
|
||||
out, count, err := manage.Search(page, pageSize, nil)
|
||||
|
||||
companys := make([]*model2.ManageCompany, 0)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -48,8 +51,6 @@ func searchCompany(page, pageSize int, keyword, industry string, params map[stri
|
||||
}
|
||||
mManageCompany := model.NewManageCompany()
|
||||
|
||||
companys := make([]*model2.ManageCompany, 0)
|
||||
|
||||
if err = model2.ScanFields(mManageCompany.ManageCompany, &companys, []string{"id", "name", "kind", "image", "product",
|
||||
"industry", "keyword", "url"}, &model2.ModelWhereOrder{Where: model2.NewWhereIn("id", ids)}); err != nil {
|
||||
return nil, err
|
||||
@ -68,5 +69,5 @@ func searchCompany(page, pageSize int, keyword, industry string, params map[stri
|
||||
Product: v.Product, Industrys: _industrys, Keywords: v.GetKeywordAttribute(),
|
||||
})
|
||||
}
|
||||
return list, nil
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package search
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/website/model"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"fmt"
|
||||
"time"
|
||||
@ -22,7 +23,7 @@ type (
|
||||
)
|
||||
|
||||
// searchDemand 需求搜索
|
||||
func searchDemand(page, pageSize int, keyword, industry string, params map[string]interface{}) (interface{}, error) {
|
||||
func searchDemand(page, pageSize int, keyword, industry string, params map[string]interface{}) (*controller.ReturnPages, error) {
|
||||
mTechnologyDemand := model.NewTechnologyDemand()
|
||||
|
||||
where := make([]*model2.ModelWhere, 0)
|
||||
@ -39,7 +40,9 @@ func searchDemand(page, pageSize int, keyword, industry string, params map[strin
|
||||
where = append(where, model2.NewWhere(k, v))
|
||||
}
|
||||
}
|
||||
out, err := mTechnologyDemand.Demand(where...)
|
||||
var count int64
|
||||
|
||||
out, err := mTechnologyDemand.Demand(page, pageSize, &count, where...)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -57,5 +60,5 @@ func searchDemand(page, pageSize int, keyword, industry string, params map[strin
|
||||
CompanyKind: v.CompanyKind,
|
||||
})
|
||||
}
|
||||
return list, nil
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package search
|
||||
import (
|
||||
"SciencesServer/app/api/website/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
config2 "SciencesServer/config"
|
||||
@ -19,7 +20,7 @@ type (
|
||||
)
|
||||
|
||||
// searchExpert 专家搜索
|
||||
func searchExpert(page, pageSize int, keyword, industry string, params map[string]interface{}) (interface{}, error) {
|
||||
func searchExpert(page, pageSize int, keyword, industry string, params map[string]interface{}) (*controller.ReturnPages, error) {
|
||||
manage := service.NewESManage(
|
||||
service.WithManageIdentity(config.TenantUserIdentityForExpert),
|
||||
service.WithManageTitle(keyword),
|
||||
@ -29,7 +30,7 @@ func searchExpert(page, pageSize int, keyword, industry string, params map[strin
|
||||
if industry != "" {
|
||||
service.WithManageIndustry(industry)(manage)
|
||||
}
|
||||
out, err := manage.Search(page, pageSize, nil)
|
||||
out, count, err := manage.Search(page, pageSize, nil)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -66,5 +67,5 @@ func searchExpert(page, pageSize int, keyword, industry string, params map[strin
|
||||
Industrys: _industrys, Keywords: v.GetKeywordAttribute(),
|
||||
})
|
||||
}
|
||||
return list, nil
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package search
|
||||
|
||||
import (
|
||||
"SciencesServer/app/basic/controller"
|
||||
"errors"
|
||||
)
|
||||
|
||||
@ -8,7 +9,7 @@ type Instance struct{}
|
||||
|
||||
type InstanceHandle func() *Instance
|
||||
|
||||
var instanceHandle = map[int]func(int, int, string, string, map[string]interface{}) (interface{}, error){
|
||||
var instanceHandle = map[int]func(int, int, string, string, map[string]interface{}) (*controller.ReturnPages, error){
|
||||
1: searchCompany, 2: achievementSearch, 3: searchLaboratory,
|
||||
4: searchPatent, 5: searchExpert, 6: searchDemand,
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package search
|
||||
import (
|
||||
"SciencesServer/app/api/website/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
config2 "SciencesServer/config"
|
||||
@ -19,7 +20,7 @@ type (
|
||||
)
|
||||
|
||||
// searchLaboratory 实验室搜索
|
||||
func searchLaboratory(page, pageSize int, keyword, industry string, params map[string]interface{}) (interface{}, error) {
|
||||
func searchLaboratory(page, pageSize int, keyword, industry string, params map[string]interface{}) (*controller.ReturnPages, error) {
|
||||
manage := service.NewESManage(
|
||||
service.WithManageIdentity(config.TenantUserIdentityForLaboratory),
|
||||
service.WithManageTitle(keyword),
|
||||
@ -29,7 +30,7 @@ func searchLaboratory(page, pageSize int, keyword, industry string, params map[s
|
||||
if industry != "" {
|
||||
service.WithManageIndustry(industry)(manage)
|
||||
}
|
||||
out, err := manage.Search(page, pageSize, nil)
|
||||
out, count, err := manage.Search(page, pageSize, nil)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -66,5 +67,5 @@ func searchLaboratory(page, pageSize int, keyword, industry string, params map[s
|
||||
Industrys: _industrys, Keywords: v.GetKeywordAttribute(),
|
||||
})
|
||||
}
|
||||
return list, nil
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package search
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/website/model"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
)
|
||||
@ -18,14 +19,14 @@ type (
|
||||
)
|
||||
|
||||
// searchPatent 专利搜索
|
||||
func searchPatent(page, pageSize int, keyword, industry string, params map[string]interface{}) (interface{}, error) {
|
||||
func searchPatent(page, pageSize int, keyword, industry string, params map[string]interface{}) (*controller.ReturnPages, error) {
|
||||
manage := service.NewESPatent(
|
||||
service.WithPatentTitle(keyword),
|
||||
)
|
||||
if industry != "" {
|
||||
service.WithPatentIndustry(industry)(manage)
|
||||
}
|
||||
out, err := manage.Search(page, pageSize)
|
||||
out, count, err := manage.Search(page, pageSize)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -55,5 +56,5 @@ func searchPatent(page, pageSize int, keyword, industry string, params map[strin
|
||||
ID: v.GetEncodeID(), Kind: v.Kind, Title: v.Title, ApplyAt: v.ApplyAt, Description: v.Description,
|
||||
})
|
||||
}
|
||||
return list, nil
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ func (c *Patent) Instance(title, industry string, page, pageSize int) (*controll
|
||||
service.WithPatentTitle(title),
|
||||
service.WithPatentIndustry(industry),
|
||||
)
|
||||
out, err := s.Search(page, pageSize)
|
||||
out, count1, err := s.Search(page, pageSize)
|
||||
|
||||
list := make([]*PatentInfo, 0)
|
||||
|
||||
@ -66,7 +66,7 @@ func (c *Patent) Instance(title, industry string, page, pageSize int) (*controll
|
||||
SysPatentInfo: v,
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
return &controller.ReturnPages{Data: list, Count: count1}, nil
|
||||
}
|
||||
|
||||
// Detail 详细信息
|
||||
|
||||
@ -15,7 +15,7 @@ type TechnologyDemandInfo struct {
|
||||
CompanyKind int `json:"company_kind"`
|
||||
}
|
||||
|
||||
func (m *TechnologyDemand) Demand(where ...*model.ModelWhere) ([]*TechnologyDemandInfo, error) {
|
||||
func (m *TechnologyDemand) Demand(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*TechnologyDemandInfo, error) {
|
||||
out := make([]*TechnologyDemandInfo, 0)
|
||||
|
||||
db := orm.GetDB().Table(m.TableName()+" AS d").
|
||||
@ -31,9 +31,13 @@ func (m *TechnologyDemand) Demand(where ...*model.ModelWhere) ([]*TechnologyDema
|
||||
db = db.Where(v.Condition, v.Value)
|
||||
}
|
||||
}
|
||||
err := db.Order("d.id " + model.OrderModeToDesc).Scan(&out).Error
|
||||
|
||||
return out, err
|
||||
if err := db.Count(count).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := db.Order("d.id " + model.OrderModeToDesc).Offset((page - 1) * pageSize).Limit(pageSize).Scan(&out).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Distribution 分布信息
|
||||
|
||||
Reference in New Issue
Block a user