Commit 2e834757 by huangchengyi

1.0

parent d70ef0d4
[web] [web]
port = 9000 port = 9000
mode = debug mode = debug
cors_domain = http://bom.liexin.com cors_domain = http://bom.liexin.com,http://liexin.com,http://www.liexin.com
[message] [message]
api_domain = http://api.ichunt.com/msg/sendMessageByAuto api_domain = http://api.ichunt.com/msg/sendMessageByAuto
......
...@@ -28,6 +28,12 @@ func GetOptimumAttrQuery(ctx *gin.Context,REQUEST_ATTR *map[string][]string,type ...@@ -28,6 +28,12 @@ func GetOptimumAttrQuery(ctx *gin.Context,REQUEST_ATTR *map[string][]string,type
}else{ }else{
query1.Must(elastic.NewTermQuery("class_id2",class_id2)) query1.Must(elastic.NewTermQuery("class_id2",class_id2))
} }
if ctx.Request.FormValue("avail_rank") == "1" { //只显示有货
query.Must(elastic.NewRangeQuery("stock").Gt(0))
}
if ctx.Request.FormValue("goods_name/condition") != "" { //型号搜索
query1.Must(elastic.NewTermQuery("goods_name",ctx.Request.FormValue("goods_name/condition")))
}
//存在属性查询 //存在属性查询
isClassAttr := 0 //存在其他属性搜索 isClassAttr := 0 //存在其他属性搜索
...@@ -79,6 +85,19 @@ func GetOptimumAttrQuery(ctx *gin.Context,REQUEST_ATTR *map[string][]string,type ...@@ -79,6 +85,19 @@ func GetOptimumAttrQuery(ctx *gin.Context,REQUEST_ATTR *map[string][]string,type
source.FetchSourceContext(elastic.NewFetchSourceContext(true).Include("goods_id")) //显示字段 source.FetchSourceContext(elastic.NewFetchSourceContext(true).Include("goods_id")) //显示字段
source.Size(common.MyInt(page_size)) source.Size(common.MyInt(page_size))
source.From(page_from) source.From(page_from)
//排序
if ctx.Request.FormValue("stock_rank") == "2" {
source.Sort("stock",true) //true asc
}else{
source.Sort("stock",false) //true asc
}
if ctx.Request.FormValue("single_rank") == "2" {
source.Sort("lower_price",true) //true asc
}else{
source.Sort("lower_price",false) //true asc
}
} }
query.Must(query1) query.Must(query1)
......
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