From 6824e26e90cdbae4e9a7cc34b04de54926da7cc2 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 1 May 2024 03:22:06 +0800 Subject: [PATCH] by Robin at 20240501 --- api/proto/zone/proto/not_null_def_api.go | 10 ++++++ api/proto/zone/proto/not_null_def_op.go | 10 ++++++ api/proto/zone/proto/zone_vo_op.go | 20 ++++++----- app/mix/service/utilservice.go | 46 ++++++++++++++++++++++-- 4 files changed, 75 insertions(+), 11 deletions(-) create mode 100644 api/proto/zone/proto/not_null_def_api.go create mode 100644 api/proto/zone/proto/not_null_def_op.go diff --git a/api/proto/zone/proto/not_null_def_api.go b/api/proto/zone/proto/not_null_def_api.go new file mode 100644 index 00000000..9b999c34 --- /dev/null +++ b/api/proto/zone/proto/not_null_def_api.go @@ -0,0 +1,10 @@ +package proto + +import "service/library/validator" + +func (p *ApiUpdateReq) ProvideNotNullValue() (params []*validator.JsonParam) { + params = make([]*validator.JsonParam, 0) + + params = append(params, validator.NewInt64PtrParam("请填写空间id!", p.Zone.Id)) + return +} diff --git a/api/proto/zone/proto/not_null_def_op.go b/api/proto/zone/proto/not_null_def_op.go new file mode 100644 index 00000000..d2be9a25 --- /dev/null +++ b/api/proto/zone/proto/not_null_def_op.go @@ -0,0 +1,10 @@ +package proto + +import "service/library/validator" + +func (p *OpUpdateReq) ProvideNotNullValue() (params []*validator.JsonParam) { + params = make([]*validator.JsonParam, 0) + + params = append(params, validator.NewInt64PtrParam("请填写空间表id!", p.Zone.Id)) + return +} diff --git a/api/proto/zone/proto/zone_vo_op.go b/api/proto/zone/proto/zone_vo_op.go index 7074b73b..cb29e849 100644 --- a/api/proto/zone/proto/zone_vo_op.go +++ b/api/proto/zone/proto/zone_vo_op.go @@ -2,21 +2,23 @@ package proto import ( streamerproto "service/api/proto/streamer/proto" + zone_collaborator_proto "service/api/proto/zone_collaborator/proto" + zone_third_partner_proto "service/api/proto/zone_third_partner/proto" "service/bizcommon/util" "service/dbstruct" ) type OpZoneVO struct { *dbstruct.Zone - 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.OpListExtVO `json:"streamer_ext"` // 主播信息 - ZoneThirdPartner *dbstruct.ZoneThirdPartner `json:"zone_third_partner"` // 代运营 - ZoneCollaboratorList []*dbstruct.ZoneCollaborator `json:"zone_collaborator_list"` // 协作者 + 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.OpListExtVO `json:"streamer_ext"` // 主播信息 + ZoneThirdPartner *zone_third_partner_proto.ZoneThirdPartnerApiVO `json:"zone_third_partner"` // 代运营 + ZoneCollaboratorList []*zone_collaborator_proto.ZoneCollaboratorApiVO `json:"zone_collaborator_list"` // 协作者 } func (vo *OpZoneVO) GetMid() int64 { diff --git a/app/mix/service/utilservice.go b/app/mix/service/utilservice.go index 5a17efe3..0888aff1 100644 --- a/app/mix/service/utilservice.go +++ b/app/mix/service/utilservice.go @@ -18,6 +18,8 @@ import ( textaudittaskproto "service/api/proto/textaudittask/proto" thumbsupproto "service/api/proto/thumbsup/proto" zoneproto "service/api/proto/zone/proto" + zone_collaborator_proto "service/api/proto/zone_collaborator/proto" + zone_third_partner_proto "service/api/proto/zone_third_partner/proto" zonemomentproto "service/api/proto/zonemoment/proto" zonemomentthumbsupproto "service/api/proto/zonemomentthumbsup/proto" "service/apollostruct" @@ -1776,6 +1778,31 @@ func (s *Service) utilFillZonesWithOpVOInfo(ctx *gin.Context, list []*dbstruct.Z return } + // 5.获取账户信息 + midSet = make(map[int64]*dbstruct.Zone) + mids = make([]int64, 0) + for _, ztp := range ztpMp { + mid := ztp.GetThirdPartnerMid() + if midSet[mid] == nil { + midSet[mid] = &dbstruct.Zone{} + mids = append(mids, mid) + } + } + for _, zclist := range zcMp { + for _, zc := range zclist { + mid := zc.GetCollaboratorMid() + if midSet[mid] == nil { + midSet[mid] = &dbstruct.Zone{} + mids = append(mids, mid) + } + } + } + acctMp, err := _DefaultAccount.GetAccountMapByMids(ctx, mids) + if err != nil { + logger.Error("GetAccountMapByMids fail, req: %v, err: %v", err) + return + } + // 8.获取空间付费信息 zvMap, _ := _DefaultVas.GetZoneVasByIds(ctx, zids) @@ -1788,10 +1815,25 @@ func (s *Service) utilFillZonesWithOpVOInfo(ctx *gin.Context, list []*dbstruct.Z vo.CopyStreamerExt(streamerExtMap[vo.GetMid()]) // 填充代运营 - vo.ZoneThirdPartner = ztpMp[zid] + ztp := ztpMp[zid] + ztpAcctVO := &accountproto.ApiListOthersVO{} + ztpAcctVO.CopyAccount(acctMp[ztp.GetThirdPartnerMid()]) + vo.ZoneThirdPartner = &zone_third_partner_proto.ZoneThirdPartnerApiVO{ + ZoneThirdPartner: ztp, + Account: ztpAcctVO, + } // 填充协作者 - vo.ZoneCollaboratorList = zcMp[zid] + zclist := zcMp[zid] + vo.ZoneCollaboratorList = make([]*zone_collaborator_proto.ZoneCollaboratorApiVO, 0) + for _, zc := range zclist { + zcAcctVO := &accountproto.ApiListOthersVO{} + zcAcctVO.CopyAccount(acctMp[zc.GetCollaboratorMid()]) + vo.ZoneCollaboratorList = append(vo.ZoneCollaboratorList, &zone_collaborator_proto.ZoneCollaboratorApiVO{ + ZoneCollaborator: zc, + Account: zcAcctVO, + }) + } if zv, ok := zvMap[zid]; ok { vo.CopyZoneVas(zv)