This commit is contained in:
jiaji.H 2026-06-08 14:04:31 +08:00
parent 17c8114b47
commit 307905849b

View File

@ -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