diff --git a/server/product/internal/logic/getproductsteppricelogic.go b/server/product/internal/logic/getproductsteppricelogic.go index 2dba7044..42868264 100644 --- a/server/product/internal/logic/getproductsteppricelogic.go +++ b/server/product/internal/logic/getproductsteppricelogic.go @@ -82,11 +82,13 @@ func (l *GetProductStepPriceLogic) GetProductStepPrice(req *types.GetProductStep mapRsp := make(map[string]interface{}) for _, modelInfo := range modelPriceList { var stepPrice gmodel.StepPriceJsonStruct - if modelInfo.StepPrice != nil { - if err = json.Unmarshal(*modelInfo.StepPrice, &stepPrice); err != nil { - logx.Error(err) - return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse step price json") - } + //没有设置阶梯价格 + if modelInfo.StepPrice == nil || len(*modelInfo.StepPrice) == 0 { + continue + } + if err = json.Unmarshal(*modelInfo.StepPrice, &stepPrice); err != nil { + logx.Error(err) + return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse step price json") } *modelInfo.PartList = strings.Trim(*modelInfo.PartList, ",") mapFittingUnit := make(map[string]interface{})