From fbeebabf27db90a9dfa30b02da83d0862ccd2d3a Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 27 Sep 2023 17:52:03 +0800 Subject: [PATCH] fix --- server/product/internal/logic/getfittingbypidlogic.go | 3 ++- server/product/internal/logic/getsizebypidlogic.go | 3 ++- server/product/internal/types/types.go | 4 ++-- server_api/product.api | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/server/product/internal/logic/getfittingbypidlogic.go b/server/product/internal/logic/getfittingbypidlogic.go index 53db5460..4b63b88b 100644 --- a/server/product/internal/logic/getfittingbypidlogic.go +++ b/server/product/internal/logic/getfittingbypidlogic.go @@ -7,6 +7,7 @@ import ( "fusenapi/model/gmodel" "fusenapi/utils/auth" "fusenapi/utils/basic" + "fusenapi/utils/format" "gorm.io/gorm" "strings" @@ -111,7 +112,7 @@ func (l *GetFittingByPidLogic) GetFittingByPid(req *types.GetFittingByPidReq, us Id: fitting.Id, MaterialImg: materialImg, Title: *fitting.Title, - Price: *fitting.Price, + Price: format.CentitoDollar(*fitting.Price, 3), ModelInfo: modelInfo, IsPopular: *fitting.IsHot > 0, }) diff --git a/server/product/internal/logic/getsizebypidlogic.go b/server/product/internal/logic/getsizebypidlogic.go index f59c6108..46d81e4f 100644 --- a/server/product/internal/logic/getsizebypidlogic.go +++ b/server/product/internal/logic/getsizebypidlogic.go @@ -6,6 +6,7 @@ import ( "fusenapi/constants" "fusenapi/utils/auth" "fusenapi/utils/basic" + "fusenapi/utils/format" "gorm.io/gorm" "strings" @@ -116,7 +117,7 @@ func (l *GetSizeByPidLogic) GetSizeByPid(req *types.GetSizeByPidReq, userinfo *a PartsCanDeleted: *sizeInfo.PartsCanDeleted > 0, ModelId: modelList[modelIndex].Id, IsPopular: *sizeInfo.IsHot > 0, - MinPrice: float64(minPrice) / 100, + MinPrice: format.CentitoDollar(minPrice, 3), IsDefault: defaultSizeId == sizeInfo.Id, }) } diff --git a/server/product/internal/types/types.go b/server/product/internal/types/types.go index 61d79237..59bcb8a7 100644 --- a/server/product/internal/types/types.go +++ b/server/product/internal/types/types.go @@ -361,7 +361,7 @@ type GetSizeByPidRsp struct { PartsCanDeleted bool `json:"parts_can_deleted"` //用户可否删除配件 ModelId int64 `json:"model_id"` //产品主模型id IsPopular bool `json:"is_popular"` //是否受欢迎 - MinPrice float64 `json:"min_price"` //最小价格 + MinPrice string `json:"min_price"` //最小价格 IsDefault bool `json:"is_default"` //是否默认(这里的默认是跟列表页一致) } @@ -379,7 +379,7 @@ type GetFittingByPidRsp struct { Id int64 `json:"id"` MaterialImg string `json:"material_img"` Title string `json:"title"` - Price int64 `json:"price"` + Price string `json:"price"` IsPopular bool `json:"is_popular"` ModelInfo interface{} `json:"model_info"` } diff --git a/server_api/product.api b/server_api/product.api index 687400ef..23c3e8fd 100644 --- a/server_api/product.api +++ b/server_api/product.api @@ -411,7 +411,7 @@ type GetSizeByPidRsp { PartsCanDeleted bool `json:"parts_can_deleted"` //用户可否删除配件 ModelId int64 `json:"model_id"` //产品主模型id IsPopular bool `json:"is_popular"` //是否受欢迎 - MinPrice float64 `json:"min_price"` //最小价格 + MinPrice string `json:"min_price"` //最小价格 IsDefault bool `json:"is_default"` //是否默认(这里的默认是跟列表页一致) } //获取产品模板 @@ -428,7 +428,7 @@ type GetFittingByPidRsp { Id int64 `json:"id"` MaterialImg string `json:"material_img"` Title string `json:"title"` - Price int64 `json:"price"` + Price string `json:"price"` IsPopular bool `json:"is_popular"` ModelInfo interface{} `json:"model_info"` }