diff --git a/server/product/internal/logic/getproductsteppricelogic.go b/server/product/internal/logic/getproductsteppricelogic.go index 71a4f8fa..2dba7044 100644 --- a/server/product/internal/logic/getproductsteppricelogic.go +++ b/server/product/internal/logic/getproductsteppricelogic.go @@ -82,13 +82,11 @@ func (l *GetProductStepPriceLogic) GetProductStepPrice(req *types.GetProductStep mapRsp := make(map[string]interface{}) for _, modelInfo := range modelPriceList { var stepPrice gmodel.StepPriceJsonStruct - if err = json.Unmarshal(*modelInfo.StepPrice, &stepPrice); err != nil { - logx.Error(err) - return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse step price json") - } - rangeLen := len(stepPrice.PriceRange) - if rangeLen == 0 { - return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("step price is not set:%d", modelInfo.Id)) + 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") + } } *modelInfo.PartList = strings.Trim(*modelInfo.PartList, ",") mapFittingUnit := make(map[string]interface{})