feat:完善项目信息

This commit is contained in:
henry
2022-01-20 11:51:02 +08:00
parent 9348c8970c
commit b87cd837be
23 changed files with 86 additions and 83 deletions

View File

@ -2,7 +2,6 @@ package service
import (
"SciencesServer/serve/es"
"SciencesServer/serve/logger"
"encoding/json"
"fmt"
)
@ -28,7 +27,7 @@ func (this *ESAchievement) Create() error {
return es.Create(this.Index(), fmt.Sprintf("%d", this.ID), _bytes)
}
func (this *ESAchievement) Search(page, pageSize int) (interface{}, error) {
func (this *ESAchievement) Search(page, pageSize int) (interface{}, int64, error) {
termParams := make(map[string]interface{}, 0)
mustParams := make(map[string]interface{}, 0)
@ -41,15 +40,10 @@ func (this *ESAchievement) Search(page, pageSize int) (interface{}, error) {
if this.Keyword != "" {
mustParams["keyword"] = this.Keyword
}
out, err := es.Search(this, this.Index(), &es.SearchParams{
return es.Search(this, this.Index(), &es.SearchParams{
TermParams: termParams,
MustParams: mustParams,
}, page, pageSize)
if err != nil {
logger.ErrorF("查询ES信息错误【%s】", err)
}
return out, nil
}
func WithAchievementID(id uint64) ESAchievementOption {

View File

@ -2,7 +2,6 @@ package service
import (
"SciencesServer/serve/es"
"SciencesServer/serve/logger"
"encoding/json"
"fmt"
)
@ -30,7 +29,7 @@ func (this *ESManage) Create() error {
return es.Create(this.Index(), fmt.Sprintf("%d", this.ID), _bytes)
}
func (this *ESManage) Search(page, pageSize int, params map[string]interface{}) (interface{}, error) {
func (this *ESManage) Search(page, pageSize int, params map[string]interface{}) (interface{}, int64, error) {
termParams := make(map[string]interface{}, 0)
shouldParams := make(map[string]interface{}, 0)
@ -51,15 +50,10 @@ func (this *ESManage) Search(page, pageSize int, params map[string]interface{})
shouldParams[k] = v
}
}
out, err := es.Search(this, this.Index(), &es.SearchParams{
return es.Search(this, this.Index(), &es.SearchParams{
TermParams: termParams,
ShouldParams: shouldParams,
}, page, pageSize)
if err != nil {
logger.ErrorF("查询ES信息错误【%s】", err)
}
return out, nil
}
func WithManageID(id uint64) ESManageOption {

View File

@ -2,7 +2,6 @@ package service
import (
"SciencesServer/serve/es"
"SciencesServer/serve/logger"
"encoding/json"
"fmt"
)
@ -28,7 +27,7 @@ func (this *ESPatent) Update() error {
return nil
}
func (this *ESPatent) Search(page, pageSize int) (interface{}, error) {
func (this *ESPatent) Search(page, pageSize int) (interface{}, int64, error) {
termParams := make(map[string]interface{}, 0)
mustParams := make(map[string]interface{}, 0)
@ -38,15 +37,10 @@ func (this *ESPatent) Search(page, pageSize int) (interface{}, error) {
if this.Industry != "" {
termParams["industry"] = this.Industry
}
out, err := es.Search(this, this.Index(), &es.SearchParams{
return es.Search(this, this.Index(), &es.SearchParams{
TermParams: termParams,
MustParams: mustParams,
}, page, pageSize)
if err != nil {
logger.ErrorF("查询ES信息错误【%s】", err)
}
return out, nil
}
func WithPatentID(id uint64) ESPatentOption {