From 6bd9a0ab05a478734ac7f5fd5f3698d55c08cefc Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Sun, 8 Oct 2023 18:07:34 +0800 Subject: [PATCH] fix --- .../internal/logic/getproductsteppricelogic.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) 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{})