|
@@ -195,11 +195,14 @@ func SupplyBuyerListData(buyerNames []string, resp *bxbuyer.BuyerListResp) *bxbu
|
|
bs, err := redis.GetBytes("other", fmt.Sprintf(BuyerSupplyInfoRedisKey, buyerNames[i]))
|
|
bs, err := redis.GetBytes("other", fmt.Sprintf(BuyerSupplyInfoRedisKey, buyerNames[i]))
|
|
if err == nil && bs != nil && len(*bs) > 0 {
|
|
if err == nil && bs != nil && len(*bs) > 0 {
|
|
tmp := supplyDataStruct{}
|
|
tmp := supplyDataStruct{}
|
|
- if err := json.Unmarshal(*bs, &tmp); err != nil {
|
|
|
|
|
|
+ if err := json.Unmarshal(*bs, &tmp); err == nil {
|
|
cacheMap[buyerNames[i]] = tmp // 拿到缓存的数据
|
|
cacheMap[buyerNames[i]] = tmp // 拿到缓存的数据
|
|
|
|
+ } else {
|
|
|
|
+ needSearchBuyer = append(needSearchBuyer, buyerNames[i]) // 没有缓存的数据 后边再查
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ needSearchBuyer = append(needSearchBuyer, buyerNames[i]) // 没有缓存的数据 后边再查
|
|
}
|
|
}
|
|
- needSearchBuyer = append(needSearchBuyer, buyerNames[i]) // 没有缓存的数据 后边再查
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -326,11 +329,15 @@ func BuyerSupplyInfo(buyerNames []string) (resp *bxbuyer.BuyerSupplyResp) {
|
|
bs, err := redis.GetBytes("other", fmt.Sprintf(BuyerSupplyInfoRedisKey, buyerNames[i]))
|
|
bs, err := redis.GetBytes("other", fmt.Sprintf(BuyerSupplyInfoRedisKey, buyerNames[i]))
|
|
if err == nil && bs != nil && len(*bs) > 0 {
|
|
if err == nil && bs != nil && len(*bs) > 0 {
|
|
tmp := supplyDataStruct{}
|
|
tmp := supplyDataStruct{}
|
|
- if err := json.Unmarshal(*bs, &tmp); err != nil {
|
|
|
|
|
|
+ if err := json.Unmarshal(*bs, &tmp); err == nil {
|
|
cacheMap[buyerNames[i]] = tmp // 拿到缓存的数据
|
|
cacheMap[buyerNames[i]] = tmp // 拿到缓存的数据
|
|
|
|
+ } else {
|
|
|
|
+ needSearchBuyer = append(needSearchBuyer, buyerNames[i]) // 没有缓存的数据 后边再查
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ needSearchBuyer = append(needSearchBuyer, buyerNames[i]) // 没有缓存的数据 后边再查
|
|
}
|
|
}
|
|
- needSearchBuyer = append(needSearchBuyer, buyerNames[i]) // 没有缓存的数据 后边再查
|
|
|
|
|
|
|
|
}
|
|
}
|
|
buyerMap := map[string]supplyDataStruct{}
|
|
buyerMap := map[string]supplyDataStruct{}
|