diff --git a/server/product/internal/logic/getpricebypidlogic.go b/server/product/internal/logic/getpricebypidlogic.go index 6c76d77a..7b02d9bd 100644 --- a/server/product/internal/logic/getpricebypidlogic.go +++ b/server/product/internal/logic/getpricebypidlogic.go @@ -109,19 +109,13 @@ func (l *GetPriceByPidLogic) dealWithStepRange(stepNumSlice, stepPriceSlice []in } num := int64(stepNum) * (*priceInfo.EachBoxNum) rangeNum := types.RangeNum{} - //只有1个 - if lenStepNum == 1 { + if numKey < lenStepNum-1 { //前面的 + nextNum := int64(stepNumSlice[numKey+1]) * (*priceInfo.EachBoxNum) + rangeNum.Begin = num + rangeNum.End = nextNum - 1 + } else { //最后一个 rangeNum.Begin = num rangeNum.End = 99999999999 - } else { - if numKey < lenStepNum-1 { //前面的 - nextNum := int64(stepNumSlice[numKey+1]) * (*priceInfo.EachBoxNum) - rangeNum.Begin = num - rangeNum.End = nextNum - 1 - } else { //最后一个 - rangeNum.Begin = num - rangeNum.End = 99999999999 - } } stepListRsp = append(stepListRsp, types.StepPrice{ RangeNum: rangeNum,