This commit is contained in:
laodaming
2023-09-26 18:35:27 +08:00
parent fcfea291e5
commit 01b78a099a
3 changed files with 38 additions and 6 deletions

View File

@@ -105,11 +105,18 @@ func (l *GetProductStepPriceLogic) GetProductStepPrice(req *types.GetProductStep
}
}
stepRange := make([]interface{}, 0, rangeLen)
for _, rangeInfo := range stepPrice.PriceRange {
for rIndex, rangeInfo := range stepPrice.PriceRange {
//最后一个
if rIndex+1 == rangeLen {
stepRange = append(stepRange, map[string]interface{}{
"range_description": fmt.Sprintf(">=%s Units", format.NumToStringWithThousandthPercentile(rangeInfo.StartQuantity)),
"item_price": format.CentitoDollar(rangeInfo.Price, 3),
})
break
}
stepRange = append(stepRange, map[string]interface{}{
"start_quantity": rangeInfo.StartQuantity,
"end_quantity": rangeInfo.EndQuantity,
"item_price": format.CentitoDollar(rangeInfo.Price, 3),
"range_description": fmt.Sprintf("%s-%s Units", format.NumToStringWithThousandthPercentile(rangeInfo.StartQuantity), format.NumToStringWithThousandthPercentile(rangeInfo.EndQuantity)),
"item_price": format.CentitoDollar(rangeInfo.Price, 3),
})
}
mapRsp[fmt.Sprintf("_%d", *modelPriceInfo.SizeId)] = map[string]interface{}{