Commit 5b4a4d21 by mushishixian

修复价格问题

parent ca209b30
Showing with 19 additions and 12 deletions
...@@ -30,7 +30,7 @@ func UpdateGoodsData(goodsMapList []GoodsMap) (err error) { ...@@ -30,7 +30,7 @@ func UpdateGoodsData(goodsMapList []GoodsMap) (err error) {
} }
goodsIdsStr := strings.Join(goodsIds, ",") goodsIdsStr := strings.Join(goodsIds, ",")
goodsList, err := GetGoodsInfo(goodsIdsStr) goodsList, err := GetGoodsInfo(goodsIdsStr)
if len(goodsMapList)!=0 { if len(goodsMapList) != 0 {
bomId = goodsMapList[0].BomId bomId = goodsMapList[0].BomId
} }
//fmt.Println(goodsIdsStr) //fmt.Println(goodsIdsStr)
...@@ -195,22 +195,29 @@ func MatchGoodsInfo(goods model.ApiGoods, goodsMap GoodsMap) (bomMatching model. ...@@ -195,22 +195,29 @@ func MatchGoodsInfo(goods model.ApiGoods, goodsMap GoodsMap) (bomMatching model.
} }
bomMatching.LadderPrice = string(ladderPriceStr) bomMatching.LadderPrice = string(ladderPriceStr)
//获取美元和人民币的价格(需要去判断数量) //获取美元和人民币的价格(需要去判断数量)
var ladder model.LadderPrice
for _, price := range goods.LadderPrice { for _, price := range goods.LadderPrice {
//需要用于获取价格的阶梯价
if goodsMap.Number <= price.Purchases { if goodsMap.Number <= price.Purchases {
//判断收货地,1是大陆,2是香港 ladder = price
if goodsMap.DeliveryType == 1 {
//判断是否有优惠价,有的话取优惠价
if price.PriceAc != 0 {
bomMatching.Price = price.PriceAc
} else {
bomMatching.Price = price.PriceCn
}
} else {
bomMatching.Price = price.PriceUs
}
break break
} }
} }
//如果都没有小于的阶梯价数量,则代表要去取最后一个阶梯价格
if ladder.Purchases == 0 {
ladder = goods.LadderPrice[len(goods.LadderPrice)-1]
}
//判断收货地,1是大陆,2是香港
if goodsMap.DeliveryType == 1 {
//判断是否有优惠价,有的话取优惠价
if ladder.PriceAc != 0 {
bomMatching.Price = ladder.PriceAc
} else {
bomMatching.Price = ladder.PriceCn
}
} else {
bomMatching.Price = ladder.PriceUs
}
} }
return 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