diff --git a/server/product/internal/logic/getpricebypidlogic.go b/server/product/internal/logic/getpricebypidlogic.go index 56fe942e..c8fb8c57 100644 --- a/server/product/internal/logic/getpricebypidlogic.go +++ b/server/product/internal/logic/getpricebypidlogic.go @@ -82,7 +82,7 @@ func (l *GetPriceByPidLogic) GetPriceByPid(req *types.GetPriceByPidReq, userinfo *priceInfo.MinBuyNum++ } //组装阶梯数量范围价格 - stepListRsp := l.dealWithStepRange(stepNumSlice, stepPriceSlice, priceInfo) + stepRange := l.dealWithStepRange(stepNumSlice, stepPriceSlice, priceInfo) //排序(必须放在其他逻辑之后) sort.Ints(stepPriceSlice) minPrice := float64(stepPriceSlice[0]) / 100 @@ -92,17 +92,17 @@ func (l *GetPriceByPidLogic) GetPriceByPid(req *types.GetPriceByPidReq, userinfo Items: itemList, MinPrice: minPrice, MaxPrice: maxPrice, - StepPrice: stepListRsp, + StepRange: stepRange, } } return resp.SetStatusWithMessage(basic.CodeOK, "success", mapRsp) } // 组装阶梯价格范围 -func (l *GetPriceByPidLogic) dealWithStepRange(stepNumSlice, stepPriceSlice []int, priceInfo gmodel.FsProductPrice) []types.StepPrice { +func (l *GetPriceByPidLogic) dealWithStepRange(stepNumSlice, stepPriceSlice []int, priceInfo gmodel.FsProductPrice) []types.StepRange { lenStepNum := len(stepNumSlice) lenStepPrice := len(stepPriceSlice) - stepListRsp := make([]types.StepPrice, 0, lenStepNum) + stepListRsp := make([]types.StepRange, 0, lenStepNum) for numKey, stepNum := range stepNumSlice { //先取最后一个 tmpPrice := float64(stepPriceSlice[lenStepPrice-1]) / 100 @@ -120,7 +120,7 @@ func (l *GetPriceByPidLogic) dealWithStepRange(stepNumSlice, stepPriceSlice []in rangeNum.Begin = num rangeNum.End = -1 } - stepListRsp = append(stepListRsp, types.StepPrice{ + stepListRsp = append(stepListRsp, types.StepRange{ RangeNum: rangeNum, Price: tmpPrice, }) diff --git a/server/product/internal/types/types.go b/server/product/internal/types/types.go index 7df0dbda..8e21b3e8 100644 --- a/server/product/internal/types/types.go +++ b/server/product/internal/types/types.go @@ -309,10 +309,10 @@ type GetPriceByPidRsp struct { Items []PriceItem `json:"items"` MinPrice float64 `json:"min_price"` MaxPrice float64 `json:"max_price"` - StepPrice []StepPrice `json:"step_price"` + StepRange []StepRange `json:"step_price"` } -type StepPrice struct { +type StepRange struct { RangeNum RangeNum `json:"range_num"` Price float64 `json:"price"` } diff --git a/server_api/product.api b/server_api/product.api index 7382f386..f3cac168 100644 --- a/server_api/product.api +++ b/server_api/product.api @@ -357,9 +357,9 @@ type GetPriceByPidRsp { Items []PriceItem `json:"items"` MinPrice float64 `json:"min_price"` MaxPrice float64 `json:"max_price"` - StepPrice []StepPrice `json:"step_price"` + StepRange []StepRange `json:"step_price"` } -type StepPrice { +type StepRange { RangeNum RangeNum `json:"range_num"` Price float64 `json:"price"` }