Commit ae492025 by mushishixian

fix bug

parent ed0c545a
Showing with 8 additions and 3 deletions
......@@ -22,7 +22,7 @@ func init() {
// "amqp://huntadmin:jy2y2900@192.168.1.237:5672/",
//}
//
//str := `{"bom_id":616,"delivery_type":1,"sort":1}`
//str := `{"bom_id":642,"delivery_type":1,"sort":1}`
//rabbitmq.Send(queueExchange, str)
}
......
......@@ -56,7 +56,7 @@ func MatchGoodsNameByAttrs(bomItems []model.BomItem) (result []model.BomItem, er
if responses.Hits != nil {
for _, hit := range responses.Hits.Hits {
res, _ := hit.Source.MarshalJSON()
if bomItems[key].GoodsName == "" {
if bomItems[key].GoodsName == "" || (bomItems[key].Attrs == "" && bomItems[key].GoodsName != "") {
bomItems[key].GoodsName = gjson.Get(string(res), "goods_name").String()
}
}
......@@ -68,7 +68,12 @@ func MatchGoodsNameByAttrs(bomItems []model.BomItem) (result []model.BomItem, er
func searchAttr(bomItem model.BomItem, search *es.MultiSearchService) (result *es.MultiSearchService) {
//先去切割参数得到参数列表
attrs := splitAttrs(bomItem.Attrs)
var attrs []string
if bomItem.GoodsName != "" && bomItem.Attrs == "" {
attrs = splitAttrs(bomItem.GoodsName)
} else {
attrs = splitAttrs(bomItem.Attrs)
}
//当切割出来的参数大于1个的时候,就要去针对每个参数进行里面再一次提纯
if len(attrs) > 1 {
for key, attr := range attrs {
......
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