Commit 4f331a22 by mushishixian

锁定结果排序

parent 057d86dd
Showing with 8 additions and 1 deletions
......@@ -15,7 +15,7 @@ urls = http://192.168.2.232:9200,http://192.168.2.232:9200
index_name = future,rochester,tme,verical,element14,digikey,chip1stop,aipco,arrow,alliedelec,avnet,mouser,zhuanmai,peigenesis,powell,rs,buerklin,liexin_ziying
search_supplier = future,rochester,tme,verical,element14,digikey,chip1stop,aipco,arrow,alliedelec,avnet,mouser,peigenesis,powell,rs,buerklin,zhuanmai
hk_delivery_type_supplier = future,rochester,tme,verical,element14,digikey,chip1stop,aipco,arrow,alliedelec,avnet,mouser,peigenesis,powell,rs,buerklin
attr_index = goods_map2
attr_index = goods_map
[database]
user_name = root
......
......@@ -5,6 +5,7 @@ import (
"github.com/tidwall/gjson"
"search_server/pkg/config"
"search_server/protopb/bom"
"strings"
)
func GetGoodsInfo(goodsIdsStr string) (goodsList []*bom.GoodsModel, err error) {
......@@ -19,7 +20,11 @@ func GetGoodsInfo(goodsIdsStr string) (goodsList []*bom.GoodsModel, err error) {
}
//先判断返回的data是不是字典,不是字典代表可能是返回字符串了
if gjson.Get(resp.String(), "data").IsObject() {
//排序操作
goodsIdList := strings.Split(goodsIdsStr, ",")
for _, goodsId := range goodsIdList {
for _, data := range gjson.Get(resp.String(), "data").Map() {
if goodsId == data.Get("goods_id").String() {
//还要去判断是否是bool
if data.IsObject() {
var goods bom.GoodsModel
......@@ -57,5 +62,7 @@ func GetGoodsInfo(goodsIdsStr string) (goodsList []*bom.GoodsModel, err error) {
}
}
}
}
}
return
}
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