This commit is contained in:
laodaming 2023-07-21 11:59:01 +08:00
parent 985fc93d00
commit b36ad4bd25

View File

@ -87,11 +87,17 @@ func (l *GetPriceByPidLogic) GetPriceByPid(req *types.GetPriceByPidReq, userinfo
tmpPrice = float64(stepPriceSlice[numKey]) / 100
}
num := int64(stepNum) * (*priceInfo.EachBoxNum)
rangeNum := fmt.Sprintf("%dPCS", num)
//不是最后一个
if numKey < lenStepNum-1 {
rangeNum := ""
if numKey < lenStepNum-1 { //前面的
nextNum := int64(stepNumSlice[numKey+1]) * (*priceInfo.EachBoxNum)
rangeNum = fmt.Sprintf("%d-%dPCS", num, nextNum-1)
//第一个
if numKey == 0 {
rangeNum = fmt.Sprintf("%d-%dPCS", num, nextNum-1)
} else {
rangeNum = fmt.Sprintf("%d-%dPCS", num, nextNum-1)
}
} else { //最后一个
rangeNum = fmt.Sprintf(">=%dPCS", num)
}
stepListRsp = append(stepListRsp, types.StepPrice{
Range: rangeNum,