Commit fb1489f8 by huangchengyi

1.0

parent e9e8acda
......@@ -15,7 +15,7 @@ func InitRouter() *gin.Engine {
r.Use(middleware.Cors())
//健康监测
r.POST("Health", func(c *gin.Context) {
r.POST("hbsdata", func(c *gin.Context) {
c.String(200,"ok")
})
......
package query
import (
"errors"
"github.com/gin-gonic/gin"
"gopkg.in/olivere/elastic.v5"
"search_server/pkg/common"
......@@ -21,11 +20,14 @@ func GetOptimumAttrQuery(ctx *gin.Context,REQUEST_ATTR *map[string][]string,type
//query1 := elastic.NewBoolQuery()
//query2 := elastic.NewBoolQuery()
//一级分类查询
class_id1 := ctx.Request.FormValue("class_id1")
if class_id1 != "" {
query.Must(elastic.NewTermQuery("class_id1",class_id1))
}
//二级分类查询
class_id2 := ctx.Request.FormValue("class_id2")
if class_id2 == "" {
return "",errors.New("二级分类不得为空")
}else{
if class_id2 != "" {
query.Must(elastic.NewTermQuery("class_id2",class_id2))
}
if ctx.Request.FormValue("avail_rank") == "1" { //只显示有货
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment