fix
This commit is contained in:
@@ -77,7 +77,7 @@ func (l *GetProductListLogic) GetProductList(req *types.GetProductListReq, login
|
||||
productIds = append(productIds, v.Id)
|
||||
}
|
||||
productPriceModel := gmodel.NewFsProductPriceModel(l.svcCtx.MysqlConn)
|
||||
productPriceList, err := productPriceModel.GetPriceListByProductIds(l.ctx, productIds)
|
||||
productPriceList, err := productPriceModel.GetSimplePriceListByProductIds(l.ctx, productIds)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get product min price list")
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
"fusenapi/utils/format"
|
||||
"fusenapi/utils/step_price"
|
||||
"strings"
|
||||
|
||||
"fusenapi/server/product/internal/svc"
|
||||
@@ -167,7 +168,7 @@ func (l *GetSizeByProductLogic) GetSecondChildrenList(product gmodel.FsProduct,
|
||||
for int(*price.MinBuyNum) < (stepNum[len(stepNum)-1]+5) && index < 3 {
|
||||
priceList = append(priceList, types.PriceObj{
|
||||
Num: int(*price.MinBuyNum * *price.EachBoxNum),
|
||||
Price: l.GetPrice(int(*price.MinBuyNum), stepNum, stepPrice),
|
||||
Price: step_price.GetStepPrice(int(*price.MinBuyNum), stepNum, stepPrice),
|
||||
})
|
||||
*price.MinBuyNum++
|
||||
index++
|
||||
@@ -181,17 +182,3 @@ func (l *GetSizeByProductLogic) GetSecondChildrenList(product gmodel.FsProduct,
|
||||
}
|
||||
return
|
||||
}
|
||||
func (l *GetSizeByProductLogic) GetPrice(minBuyNum int, stepNum []int, stepPrice []int) float64 {
|
||||
if minBuyNum > stepNum[len(stepNum)-1] {
|
||||
return float64(stepPrice[len(stepPrice)-1]) / float64(100)
|
||||
}
|
||||
for k, v := range stepNum {
|
||||
if minBuyNum <= v {
|
||||
if k <= (len(stepPrice) - 1) {
|
||||
return float64(stepPrice[k]) / float64(100)
|
||||
}
|
||||
return float64(stepPrice[len(stepPrice)-1]) / float64(100)
|
||||
}
|
||||
}
|
||||
return float64(stepPrice[len(stepPrice)-1]) / float64(100)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user