Commit 36f58f51 by mushishixian

fix bug

parent 22793d17
...@@ -22,7 +22,7 @@ func init() { ...@@ -22,7 +22,7 @@ func init() {
// "amqp://huntadmin:jy2y2900@192.168.1.237:5672/", // "amqp://huntadmin:jy2y2900@192.168.1.237:5672/",
//} //}
// //
//str := `{"bom_id":236,"delivery_type":1,"sort":3}` //str := `{"bom_id":237,"delivery_type":1,"sort":2}`
//rabbitmq.Send(queueExchange, str) //rabbitmq.Send(queueExchange, str)
} }
......
...@@ -133,7 +133,6 @@ func GetGoodsInfo(goodsIdsStr string) (goodsList []model.ApiGoods, err error) { ...@@ -133,7 +133,6 @@ func GetGoodsInfo(goodsIdsStr string) (goodsList []model.ApiGoods, err error) {
func MatchGoodsInfo(goods model.ApiGoods, goodsMap GoodsMap) (bomMatching model.BomItemMatching, err error) { func MatchGoodsInfo(goods model.ApiGoods, goodsMap GoodsMap) (bomMatching model.BomItemMatching, err error) {
//组装需要去更新的商品信息 //组装需要去更新的商品信息
var delivery string var delivery string
if goodsMap.DeliveryType == 1 { if goodsMap.DeliveryType == 1 {
delivery = goods.CnDeliveryTime delivery = goods.CnDeliveryTime
} else { } else {
......
...@@ -211,6 +211,7 @@ func getUpdateGoodsData(bomId int, bomItems []model.BomItem, deliveryType, sort ...@@ -211,6 +211,7 @@ func getUpdateGoodsData(bomId int, bomItems []model.BomItem, deliveryType, sort
goodsMap.BomItemId = bomItems[key].BomItemID goodsMap.BomItemId = bomItems[key].BomItemID
goodsMap.BomId = bomId goodsMap.BomId = bomId
goodsMap.DeliveryType = deliveryType goodsMap.DeliveryType = deliveryType
goodsMapList = append(goodsMapList, goodsMap) goodsMapList = append(goodsMapList, goodsMap)
break break
} }
...@@ -223,7 +224,6 @@ func getUpdateGoodsData(bomId int, bomItems []model.BomItem, deliveryType, sort ...@@ -223,7 +224,6 @@ func getUpdateGoodsData(bomId int, bomItems []model.BomItem, deliveryType, sort
func getSearchParams(goodsName, brandName string, sort, number int, flag bool) (searchRequest *es.SearchRequest) { func getSearchParams(goodsName, brandName string, sort, number int, flag bool) (searchRequest *es.SearchRequest) {
query := getTermQuery(goodsName, brandName, number, flag) query := getTermQuery(goodsName, brandName, number, flag)
source := es.NewSearchSource().IndexBoost("liexin_ziying", 2).Query(query) source := es.NewSearchSource().IndexBoost("liexin_ziying", 2).Query(query)
source.Sort("_score", false)
if sort == 1 { if sort == 1 {
source.Sort("sort", false) source.Sort("sort", false)
source.Sort("stock", false) source.Sort("stock", false)
...@@ -238,6 +238,7 @@ func getSearchParams(goodsName, brandName string, sort, number int, flag bool) ( ...@@ -238,6 +238,7 @@ func getSearchParams(goodsName, brandName string, sort, number int, flag bool) (
source.Sort("stock_sort", false) source.Sort("stock_sort", false)
source.Sort("stock", false) source.Sort("stock", false)
} }
source.Sort("_score", false)
source = source.From(0).Size(1) source = source.From(0).Size(1)
searchRequest = es.NewSearchRequest().Source(source) searchRequest = es.NewSearchRequest().Source(source)
return searchRequest return searchRequest
...@@ -265,7 +266,7 @@ func getTermQuery(goodsName, brandName string, number int, flag bool) (query *es ...@@ -265,7 +266,7 @@ func getTermQuery(goodsName, brandName string, number int, flag bool) (query *es
query = query.Must(es.NewTermQuery(field, goodsName)) query = query.Must(es.NewTermQuery(field, goodsName))
} }
query = query.Filter(es.NewTermQuery("status", 1)) query = query.Filter(es.NewTermQuery("status", 1))
query = query.Filter(es.NewRangeQuery("single_price").Gt(0)) //query = query.Filter(es.NewRangeQuery("single_price").Gt(0))
//src, err := query.Source() //src, err := query.Source()
//if err != nil { //if err != nil {
// panic(err) // panic(err)
......
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