fix
This commit is contained in:
parent
55eabd5cae
commit
cf59a03129
|
@ -206,8 +206,8 @@ func (l *GetProductInfoLogic) GetProductInfo(req *types.GetProductInfoReq, useri
|
|||
//循环阶梯价计算
|
||||
type MaterialSizePrice struct {
|
||||
Items []interface{} `json:"items"`
|
||||
MinPrice string `json:"min_price"`
|
||||
MaxPrice string `json:"max_price"`
|
||||
MinPrice float64 `json:"min_price"`
|
||||
MaxPrice float64 `json:"max_price"`
|
||||
}
|
||||
mapMaterialSizePrice := make(map[string]*MaterialSizePrice)
|
||||
//循环处理组装模板信息
|
||||
|
@ -337,14 +337,18 @@ func (l *GetProductInfoLogic) GetProductInfo(req *types.GetProductInfoReq, useri
|
|||
for *priceItem.MinBuyNum < int64(stepNumSlice[lenStepNum-1]+5) {
|
||||
price := step_price.GetCentStepPrice(int(*priceItem.MinBuyNum), stepNumSlice, stepPriceSlice)
|
||||
mapMaterialSizePriceKey := l.getMapMaterialSizePriceKey(*priceItem.MaterialId, *priceItem.SizeId)
|
||||
minPriceStr := fmt.Sprintf("%.2f", float64(stepPriceSlice[lenStepPrice-1])/100)
|
||||
minPrice, _ := strconv.ParseFloat(minPriceStr, 64)
|
||||
maxPriceStr := fmt.Sprintf("%.2f", float64(stepPriceSlice[0])/100)
|
||||
maxPrice, _ := strconv.ParseFloat(maxPriceStr, 64)
|
||||
if _, ok := mapMaterialSizePrice[mapMaterialSizePriceKey]; ok {
|
||||
mapMaterialSizePrice[mapMaterialSizePriceKey].Items = append(mapMaterialSizePrice[mapMaterialSizePriceKey].Items, map[string]interface{}{
|
||||
"num": *priceItem.MinBuyNum,
|
||||
"total_num": *priceItem.MinBuyNum * (*priceItem.EachBoxNum),
|
||||
"price": price,
|
||||
})
|
||||
mapMaterialSizePrice[mapMaterialSizePriceKey].MinPrice = fmt.Sprintf("%.2f", float64(stepPriceSlice[lenStepPrice-1])/100)
|
||||
mapMaterialSizePrice[mapMaterialSizePriceKey].MaxPrice = fmt.Sprintf("%.2f", float64(stepPriceSlice[0])/100)
|
||||
mapMaterialSizePrice[mapMaterialSizePriceKey].MinPrice = minPrice
|
||||
mapMaterialSizePrice[mapMaterialSizePriceKey].MaxPrice = maxPrice
|
||||
} else {
|
||||
items := map[string]interface{}{
|
||||
"num": *priceItem.MinBuyNum,
|
||||
|
@ -353,8 +357,8 @@ func (l *GetProductInfoLogic) GetProductInfo(req *types.GetProductInfoReq, useri
|
|||
}
|
||||
mapMaterialSizePrice[mapMaterialSizePriceKey] = &MaterialSizePrice{
|
||||
Items: []interface{}{items},
|
||||
MinPrice: fmt.Sprintf("%.2f", float64(stepPriceSlice[lenStepPrice-1])/100),
|
||||
MaxPrice: fmt.Sprintf("%.2f", float64(stepPriceSlice[0])/100),
|
||||
MinPrice: minPrice,
|
||||
MaxPrice: maxPrice,
|
||||
}
|
||||
}
|
||||
*priceItem.MinBuyNum++
|
||||
|
|
Loading…
Reference in New Issue
Block a user