This commit is contained in:
laodaming 2023-09-27 14:13:34 +08:00
parent d5e5f7e6e2
commit 59114aa94a

View File

@ -7,6 +7,7 @@ import (
"fmt"
"fusenapi/constants"
"github.com/zeromicro/go-zero/core/logx"
"sort"
)
// 阶梯价结构
@ -196,6 +197,9 @@ func (d *FsProductModel3dModel) GetProductMinPrice(ctx context.Context, productI
if lenRange == 0 {
return errors.New(fmt.Sprintf("the count of step price is 0:%d", modelInfo.Id))
}
sort.SliceStable(stepPrice.PriceRange, func(i, j int) bool {
return stepPrice.PriceRange[i].Price < stepPrice.PriceRange[j].Price
})
mapModelMinPrice[modelInfo.Id] = stepPrice.PriceRange[lenRange-1].Price
case constants.TAG_PARTS: //配件
mapModelMinPrice[modelInfo.Id] = *modelInfo.Price