From 50ef95271cbc5ea4a72b4fa853abf406b5eb4a61 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Tue, 16 Apr 2024 19:48:15 +0800 Subject: [PATCH] by Robin at 20240416 --- api/proto/zone/proto/zone_vo_api.go | 31 ++++++++++++++++++++++------- app/mix/service/utilservice.go | 9 ++++++++- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/api/proto/zone/proto/zone_vo_api.go b/api/proto/zone/proto/zone_vo_api.go index 70e3c50a..2e93e09c 100644 --- a/api/proto/zone/proto/zone_vo_api.go +++ b/api/proto/zone/proto/zone_vo_api.go @@ -8,13 +8,19 @@ import ( type ApiZoneVO struct { *dbstruct.Zone - StreamerExt *streamerproto.ApiListExtVO `json:"streamer_ext"` - IsUnreadZoneMomentExist int64 `json:"is_unread_zone_moment_exist"` - VisitorRole int64 `json:"visitor_role"` - Previews *dbstruct.MediaComponent `json:"previews"` - Expenditure int64 `json:"expenditure"` - IsIronfanshipUnlocked int64 `json:"is_ironfanship_unlocked"` - IsSuperfanshipUnlocked int64 `json:"is_superfanship_unlocked"` + AdmissionPrice int64 `json:"admission_price" bson:"admission_price"` // 空间解锁价格, 单位: 分 + IronfanshipPrice int64 `json:"ironfanship_price" bson:"ironfanship_price"` // 铁粉解锁价格, 单位: 分 + IsSuperfanshipEnabled int `json:"is_superfanship_enabled" bson:"is_superfanship_enabled"` // 是否开启超粉空间 0: 关闭, 1: 开启 + SuperfanshipPrice int64 `json:"superfanship_price" bson:"superfanship_price"` // 超粉价格, 单位: 分 + SuperfanshipValidPeriod int `json:"superfanship_valid_period" bson:"superfanship_valid_period"` // 超粉有效期类型, SuperfanshipValidPeriod* + IsSuperfanshipGiveWechat int `json:"is_superfanship_give_wechat" bson:"is_superfanship_give_wechat"` // 是否开启超粉空间赠送微信 0: 不赠送, 1: 赠送 + StreamerExt *streamerproto.ApiListExtVO `json:"streamer_ext"` + IsUnreadZoneMomentExist int64 `json:"is_unread_zone_moment_exist"` + VisitorRole int64 `json:"visitor_role"` + Previews *dbstruct.MediaComponent `json:"previews"` + Expenditure int64 `json:"expenditure"` + IsIronfanshipUnlocked int64 `json:"is_ironfanship_unlocked"` + IsSuperfanshipUnlocked int64 `json:"is_superfanship_unlocked"` } func (vo *ApiZoneVO) GetMid() int64 { @@ -45,3 +51,14 @@ func (vo *ApiZoneVO) SetIsIronfanshipUnlocked(is_ironfanship_unlocked int64) { func (vo *ApiZoneVO) SetIsSuperfanshipUnlocked(is_superfanship_unlocked int64) { vo.IsSuperfanshipUnlocked = is_superfanship_unlocked } + +func (vo *ApiZoneVO) CopyZoneVas(zv *dbstruct.ZoneVas) { + if zv != nil { + vo.AdmissionPrice = zv.AdmissionPrice + vo.IronfanshipPrice = zv.IronfanshipPrice + vo.IsSuperfanshipEnabled = zv.IsSuperfanshipEnabled + vo.SuperfanshipPrice = zv.SuperfanshipPrice + vo.SuperfanshipValidPeriod = zv.SuperfanshipValidPeriod + vo.IsSuperfanshipGiveWechat = zv.IsSuperfanshipGiveWechat + } +} diff --git a/app/mix/service/utilservice.go b/app/mix/service/utilservice.go index 6a860096..2383d551 100644 --- a/app/mix/service/utilservice.go +++ b/app/mix/service/utilservice.go @@ -1515,7 +1515,10 @@ func (s *Service) utilFillZonesWithApiVOInfo(ctx *gin.Context, list []*dbstruct. zoneZidMap[zone.GetId()] = zone } - // 8.填充信息 + // 8.获取空间付费信息 + zvMap, _ := _DefaultVas.GetZoneVasByIds(ctx, zids) + + // 9.填充信息 for _, vo := range volist { zid := vo.Zone.GetId() @@ -1572,6 +1575,10 @@ func (s *Service) utilFillZonesWithApiVOInfo(ctx *gin.Context, list []*dbstruct. } else { vo.IsSuperfanshipUnlocked = consts.IsSuperfanshipUnlocked_No } + + if zv, ok := zvMap[zid]; ok { + vo.CopyZoneVas(zv) + } } return