by Robin at 20240801

This commit is contained in:
Leufolium 2024-08-01 16:52:27 +08:00
parent 7ec3af4584
commit 0b2c83e215
2 changed files with 22 additions and 10 deletions

View File

@ -114,6 +114,7 @@ func ApiGetZoneMomentListByCreaterMid(ctx *gin.Context) {
mediaFillableList[objectMediaNum*i+4] = vo.StreamerExt.Avatar
}
mediafiller.FillList(ctx, mediaFillableList)
service.DefaultService.UtilEncryptVideosForZoneMomentVOs(list)
data := &zonemomentproto.ApiListByCreaterMidData{
List: list,
@ -150,6 +151,7 @@ func ApiGetZoneMomentListByZid(ctx *gin.Context) {
mediaFillableList[objectMediaNum*i+4] = vo.StreamerExt.Avatar
}
mediafiller.FillList(ctx, mediaFillableList)
service.DefaultService.UtilEncryptVideosForZoneMomentVOs(list)
data := &zonemomentproto.ApiListByZidData{
List: list,

View File

@ -881,16 +881,6 @@ func (s *Service) utilEncryptInaccessibleZoneMoment(vo *zonemomentproto.ApiZoneM
}
imageIds = imageIds[:mediaVisibleRange]
vo.MediaComp.ImageIds = util.Int64Slice(imageIds)
} else if vo.GetMType() == consts.MediaTypeVideo {
videoIdForUploadFail, err := apollo.GetIntValue(consts.VideoIdForUploadFail, apollo.ApolloOpts().SetNamespace("application"))
if err != nil {
logger.Error("Apollo read failed : %v", err)
}
videoIds := vo.MediaComp.GetVideoIds()
for i := range videoIds {
videoIds[i] = int64(videoIdForUploadFail)
}
vo.MediaComp.VideoIds = util.Int64Slice(videoIds)
}
}
@ -2071,3 +2061,23 @@ func (s *Service) utilSignHvyogoMessage(msg interfaces.HvyogoSignable) ([]byte,
return resultBytes, nil
}
func (s *Service) UtilEncryptVideosForZoneMomentVOs(list []*zonemomentproto.ApiZoneMomentVO) {
videoIdForUploadFail, err := apollo.GetIntValue(consts.VideoIdForUploadFail, apollo.ApolloOpts().SetNamespace("application"))
if err != nil {
logger.Error("Apollo read failed : %v", err)
}
for _, vo := range list {
if vo.IsZoneMomentUnlocked == consts.IsZoneMomentUnlocked_No {
videoIds := vo.MediaComp.GetVideoIds()
for i := range videoIds {
videoIds[i] = int64(videoIdForUploadFail)
}
vo.MediaComp.VideoIds = util.Int64Slice(videoIds)
for _, video := range vo.MediaComp.Videos {
video.Urls = make([]string, 0)
}
}
}
}