From f6f305f0f37547e5b1458872e29fb6a50a2e2bb6 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 1 Nov 2023 16:58:26 +0800 Subject: [PATCH] fix --- model/gmodel/fs_product_gen.go | 1 + .../internal/logic/getproductdetaillogic.go | 9 +++++++++ server/product/internal/types/types.go | 17 +++++++++-------- server_api/product.api | 17 +++++++++-------- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/model/gmodel/fs_product_gen.go b/model/gmodel/fs_product_gen.go index f2e5d931..134f1bae 100644 --- a/model/gmodel/fs_product_gen.go +++ b/model/gmodel/fs_product_gen.go @@ -36,6 +36,7 @@ type FsProduct struct { RecommendProductSort *string `gorm:"default:'';" json:"recommend_product_sort"` // SceneIds *string `gorm:"default:'';" json:"scene_ids"` // IsCustomization *int64 `gorm:"default:0;" json:"is_customization"` // 是否可定制 + WebsiteUnit *string `gorm:"default:'';" json:"website_unit"` // Unit *string `gorm:"default:'';" json:"unit"` // SupplyChainManager *int64 `gorm:"default:0;" json:"supply_chain_manager"` // 供应链负责人 } diff --git a/server/product/internal/logic/getproductdetaillogic.go b/server/product/internal/logic/getproductdetaillogic.go index 32b0c496..17991820 100644 --- a/server/product/internal/logic/getproductdetaillogic.go +++ b/server/product/internal/logic/getproductdetaillogic.go @@ -67,6 +67,14 @@ func (l *GetProductDetailLogic) GetProductDetail(req *types.GetProductDetailReq, if *productInfo.IsDel == 1 { return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "the product status is deleted") } + //解析产品单位 + var websiteUnit interface{} + if *productInfo.WebsiteUnit != "" { + if err = json.Unmarshal([]byte(*productInfo.WebsiteUnit), &websiteUnit); err != nil { + logx.Error(err) + return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse website unit") + } + } //获取产品类型 productTag, err := l.svcCtx.AllModels.FsTags.FindOne(l.ctx, *productInfo.Type) if err != nil { @@ -256,6 +264,7 @@ func (l *GetProductDetailLogic) GetProductDetail(req *types.GetProductDetailReq, IsEnv: *productInfo.IsProtection, IsMicro: *productInfo.IsMicrowave, IsCustomization: *productInfo.IsCustomization, + WebsiteUnit: websiteUnit, }, BaseColors: color_list.GetColor(), SizeList: rspSizeList, diff --git a/server/product/internal/types/types.go b/server/product/internal/types/types.go index 4e591ca2..fe72e1d8 100644 --- a/server/product/internal/types/types.go +++ b/server/product/internal/types/types.go @@ -155,14 +155,15 @@ type LightInfo struct { } type ProductInfo struct { - Id int64 `json:"id"` //产品id - Description string `json:"description"` //产品描述 - ProductType int64 `json:"product_type"` //产品类型id - ProductTypeName string `json:"product_type_name"` //产品类型名称 - Title string `json:"title"` //产品标题 - IsEnv int64 `json:"is_env"` //是否环保 - IsMicro int64 `json:"is_micro"` //是否可微波炉 - IsCustomization int64 `json:"is_customization"` //是否可定制产品 + Id int64 `json:"id"` //产品id + Description string `json:"description"` //产品描述 + ProductType int64 `json:"product_type"` //产品类型id + ProductTypeName string `json:"product_type_name"` //产品类型名称 + Title string `json:"title"` //产品标题 + IsEnv int64 `json:"is_env"` //是否环保 + IsMicro int64 `json:"is_micro"` //是否可微波炉 + IsCustomization int64 `json:"is_customization"` //是否可定制产品 + WebsiteUnit interface{} `json:"website_unit"` //产品前台网站单位 } type TemplateTagColorInfo struct { diff --git a/server_api/product.api b/server_api/product.api index 622df5a0..bb65c5a5 100644 --- a/server_api/product.api +++ b/server_api/product.api @@ -171,14 +171,15 @@ type LightInfo { LightDesignInfo interface{} `json:"light_design_info"` //灯光设计信息 } type ProductInfo { - Id int64 `json:"id"` //产品id - Description string `json:"description"` //产品描述 - ProductType int64 `json:"product_type"` //产品类型id - ProductTypeName string `json:"product_type_name"` //产品类型名称 - Title string `json:"title"` //产品标题 - IsEnv int64 `json:"is_env"` //是否环保 - IsMicro int64 `json:"is_micro"` //是否可微波炉 - IsCustomization int64 `json:"is_customization"` //是否可定制产品 + Id int64 `json:"id"` //产品id + Description string `json:"description"` //产品描述 + ProductType int64 `json:"product_type"` //产品类型id + ProductTypeName string `json:"product_type_name"` //产品类型名称 + Title string `json:"title"` //产品标题 + IsEnv int64 `json:"is_env"` //是否环保 + IsMicro int64 `json:"is_micro"` //是否可微波炉 + IsCustomization int64 `json:"is_customization"` //是否可定制产品 + WebsiteUnit interface{} `json:"website_unit"` //产品前台网站单位 } type TemplateTagColorInfo { Colors [][]string `json:"colors"` //传入logo对应的算法颜色组