fix
This commit is contained in:
parent
104a9db7ea
commit
2b5c8c9cd6
|
@ -104,6 +104,17 @@ func (l *GetPriceByPidLogic) dealWithStepRange(stepNumSlice, stepPriceSlice []in
|
|||
lenStepNum := len(stepNumSlice)
|
||||
lenStepPrice := len(stepPriceSlice)
|
||||
stepListRsp := make([]types.StepRange, 0, lenStepNum)
|
||||
//只有一个阶梯价格
|
||||
if lenStepPrice == 1 {
|
||||
stepListRsp = append(stepListRsp, types.StepRange{
|
||||
Begin: *priceInfo.MinBuyNum * (*priceInfo.EachBoxNum),
|
||||
End: -1,
|
||||
Price: float64(stepPriceSlice[0]) / 100,
|
||||
})
|
||||
return stepListRsp
|
||||
}
|
||||
begin := int64(0)
|
||||
end := int64(0)
|
||||
for numKey, stepNum := range stepNumSlice {
|
||||
//先取最后一个
|
||||
tmpPrice := float64(stepPriceSlice[lenStepPrice-1]) / 100
|
||||
|
@ -111,23 +122,12 @@ func (l *GetPriceByPidLogic) dealWithStepRange(stepNumSlice, stepPriceSlice []in
|
|||
if numKey < lenStepPrice {
|
||||
tmpPrice = float64(stepPriceSlice[numKey]) / 100
|
||||
}
|
||||
num := int64(stepNum) * (*priceInfo.EachBoxNum)
|
||||
begin := int64(0)
|
||||
end := int64(0)
|
||||
if numKey == 0 { //第一个
|
||||
begin = *priceInfo.MinBuyNum * (*priceInfo.EachBoxNum)
|
||||
//只有一阶价格
|
||||
if lenStepPrice == 1 {
|
||||
end = -1
|
||||
} else {
|
||||
end = num - 1
|
||||
}
|
||||
} else if numKey < lenStepNum-1 { //中间的
|
||||
nextNum := int64(stepNumSlice[numKey+1]) * (*priceInfo.EachBoxNum)
|
||||
begin = num
|
||||
end = nextNum - 1
|
||||
} else { //最后的
|
||||
begin = num
|
||||
begin = int64(stepNum) * (*priceInfo.EachBoxNum)
|
||||
//不是最后一个
|
||||
if numKey < lenStepNum-1 {
|
||||
nextBegin := int64(stepNumSlice[numKey+1]) * (*priceInfo.EachBoxNum)
|
||||
end = nextBegin - 1
|
||||
} else {
|
||||
end = -1
|
||||
}
|
||||
stepListRsp = append(stepListRsp, types.StepRange{
|
||||
|
|
Loading…
Reference in New Issue
Block a user