fix
This commit is contained in:
parent
142ada5b07
commit
1dfa390557
|
@ -6,7 +6,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"fusenapi/constants"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sort"
|
||||
)
|
||||
|
||||
|
@ -186,11 +185,11 @@ func (d *FsProductModel3dModel) GetProductMinPrice(ctx context.Context, productI
|
|||
switch *modelInfo.Tag {
|
||||
case constants.TAG_MODEL: //模型
|
||||
if modelInfo.StepPrice == nil || len(*modelInfo.StepPrice) == 0 {
|
||||
return errors.New(fmt.Sprintf("model step price is not set:%d", modelInfo.Id))
|
||||
mapModelMinPrice[modelInfo.Id] = 0
|
||||
continue
|
||||
}
|
||||
var stepPrice StepPriceJsonStruct
|
||||
if err = json.Unmarshal(*modelInfo.StepPrice, &stepPrice); err != nil {
|
||||
logx.Error(err)
|
||||
return errors.New(fmt.Sprintf("failed to parse model step price:%d", modelInfo.Id))
|
||||
}
|
||||
lenRange := len(stepPrice.PriceRange)
|
||||
|
|
|
@ -94,6 +94,7 @@ func (l *GetRecommandProductListLogic) GetRecommandProductList(req *types.GetRec
|
|||
//获取产品最低价
|
||||
mapProductMinPrice := make(map[int64]int64)
|
||||
if err = l.svcCtx.AllModels.FsProductModel3d.GetProductMinPrice(l.ctx, productIds, mapProductMinPrice); err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get product min price")
|
||||
}
|
||||
//获取产品标签相关属性
|
||||
|
|
|
@ -229,6 +229,7 @@ func (l *GetTagProductListLogic) getProductRelationInfo(req getProductRelationIn
|
|||
}
|
||||
//获取产品最低价格
|
||||
if err = l.svcCtx.AllModels.FsProductModel3d.GetProductMinPrice(l.ctx, productIds, req.MapProductMinPrice); err != nil {
|
||||
logx.Error(err)
|
||||
return nil, errors.New("failed to get product min price")
|
||||
}
|
||||
//获取模板
|
||||
|
|
|
@ -114,6 +114,7 @@ func (l *HomePageRecommendProductListLogic) HomePageRecommendProductList(req *ty
|
|||
//获取产品最低价格
|
||||
mapProductMinPrice := make(map[int64]int64)
|
||||
if err = l.svcCtx.AllModels.FsProductModel3d.GetProductMinPrice(l.ctx, productIds, mapProductMinPrice); err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get product min price")
|
||||
}
|
||||
//获取模板(只是获取产品product_id)
|
||||
|
|
Loading…
Reference in New Issue
Block a user