From 307905849b5f2fd781204bb89b70c01927c8e7a9 Mon Sep 17 00:00:00 2001 From: "jiaji.H" Date: Mon, 8 Jun 2026 14:04:31 +0800 Subject: [PATCH] Update --- internal/logic/bundleLogic.go | 42 ++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/internal/logic/bundleLogic.go b/internal/logic/bundleLogic.go index b3810c6..300cfcb 100644 --- a/internal/logic/bundleLogic.go +++ b/internal/logic/bundleLogic.go @@ -339,6 +339,7 @@ func BundleListV2(req *bundle.BundleListRequest) (res *bundle.BundleListResponse func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailResponseV2, err error) { res = new(bundle.BundleDetailResponseV2) bundleProfile := &bundle.BundleProfile{} + var bundleProfileLang *bundle.BundleProfileLang if req.Uuid == "" { return res, errors.New("缺少套餐UUID") @@ -347,13 +348,44 @@ func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailRe if err != nil { return res, errors.New("获取套餐信息失败") } + if req.Language != "" { + for _, lang := range detail.BundleProfileLang { + if lang.Language == req.Language { + bundleProfileLang = &bundle.BundleProfileLang{ + Uuid: lang.UUID, + Name: lang.Name, + Price: lang.Price, + PriceType: lang.PriceType, + Content: lang.Content, + PayLaterTime: lang.PayLaterTime, + } + break + } + } + } else { + //默认返回中文数据 + for _, lang := range detail.BundleProfileLang { + if lang.Language == msg.ZH_CN { + bundleProfileLang = &bundle.BundleProfileLang{ + Uuid: lang.UUID, + Name: lang.Name, + Price: lang.Price, + PriceType: lang.PriceType, + Content: lang.Content, + PayLaterTime: lang.PayLaterTime, + } + break + } + } + } + if detail != nil { bundleProfile = &bundle.BundleProfile{ Uuid: detail.UUID, - Name: detail.Name, - Content: detail.Content, - Price: detail.Price, - PriceType: detail.PriceType, + Name: bundleProfileLang.Name, + Content: bundleProfileLang.Content, + Price: bundleProfileLang.Price, + PriceType: bundleProfileLang.PriceType, ImgOption: int32(detail.ImgOption), BgImg1: detail.BgImg1, BgImg2: detail.BgImg2, @@ -364,7 +396,7 @@ func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailRe UpdatedAt: detail.UpdatedAt.Format("2006-01-02 15:04:05"), Contract: detail.Contract, BundleType: int64(detail.BundleType), - PayLaterTime: int64(detail.PayLaterTime), + PayLaterTime: int64(bundleProfileLang.PayLaterTime), } if len(detail.BundleToValueAddService) > 0 { var valueUuids []string