feat:优化项目信息
This commit is contained in:
@ -10,7 +10,6 @@ type ESPatent struct {
|
||||
ID uint64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Industry string `json:"industry"` // 行业领域
|
||||
IsShow int `json:"is_show"` // 展示
|
||||
}
|
||||
|
||||
type ESPatentOption func(patent *ESPatent)
|
||||
@ -33,9 +32,6 @@ func (this *ESPatent) Update() error {
|
||||
if this.Industry != "" {
|
||||
_map["industry"] = this.Industry
|
||||
}
|
||||
if this.IsShow != 0 {
|
||||
_map["is_show"] = this.IsShow
|
||||
}
|
||||
return es.Update(this.Index(), fmt.Sprintf("%d", this.ID), _map)
|
||||
}
|
||||
|
||||
@ -53,8 +49,6 @@ func (this *ESPatent) Search(page, pageSize int) (interface{}, int64, error) {
|
||||
if this.Industry != "" {
|
||||
termParams["industry"] = this.Industry
|
||||
}
|
||||
termParams["is_show"] = 1
|
||||
|
||||
return es.Search(this, this.Index(), &es.SearchParams{
|
||||
TermParams: termParams,
|
||||
MustParams: mustParams,
|
||||
@ -79,12 +73,6 @@ func WithPatentIndustry(industry string) ESPatentOption {
|
||||
}
|
||||
}
|
||||
|
||||
func WithPatentShow(show int) ESPatentOption {
|
||||
return func(patent *ESPatent) {
|
||||
patent.IsShow = show
|
||||
}
|
||||
}
|
||||
|
||||
func NewESPatent(options ...ESPatentOption) *ESPatent {
|
||||
out := new(ESPatent)
|
||||
|
||||
|
Reference in New Issue
Block a user