This commit is contained in:
laodaming
2023-11-24 16:51:46 +08:00
parent 4cacf2c16d
commit b72d1675e4
2 changed files with 56 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ package logic
import (
"encoding/json"
"errors"
"fmt"
"fusenapi/constants"
"fusenapi/model/gmodel"
"fusenapi/utils/auth"
@@ -162,9 +163,9 @@ func (l *GetProductDetailLogic) GetProductDetail(req *types.GetProductDetailReq,
for k, v := range templateList {
mapModelIdKeyTemplate[*v.ModelId] = k
}
//记录产品最低价
mapProductMinPrice := make(map[int64]int64)
if err = l.svcCtx.AllModels.FsProductModel3d.GetProductMinPrice(modelList, mapProductMinPrice); err != nil {
//记录产品尺寸最低价
mapProductSizeMinPrice := make(map[string]int64)
if err = l.svcCtx.AllModels.FsProductModel3d.GetProductSizeMinPrice(modelList, mapProductSizeMinPrice); err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get product min price")
}
@@ -184,7 +185,7 @@ func (l *GetProductDetailLogic) GetProductDetail(req *types.GetProductDetailReq,
}
//尺寸下最低价
minPrice := ""
if price, ok := mapProductMinPrice[*sizeInfo.ProductId]; ok {
if price, ok := mapProductSizeMinPrice[fmt.Sprintf("%d_%d", *sizeInfo.ProductId, sizeInfo.Id)]; ok {
minPrice = format.CentitoDollar(price, 3)
}
var modelInfoRsp types.ModelInfo