Merge pull request 'mainconflict' (#696) from mainconflict into main

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/696
This commit is contained in:
chenhao 2024-08-09 18:18:29 +08:00
commit 1a83345fa5
2 changed files with 34 additions and 0 deletions

View File

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

View File

@ -32,6 +32,7 @@ import (
"service/dbstruct" "service/dbstruct"
"service/library/apollo" "service/library/apollo"
"service/library/logger" "service/library/logger"
"service/library/mediafiller"
"service/library/mycrypto" "service/library/mycrypto"
"service/library/redis" "service/library/redis"
"service/library/validator" "service/library/validator"
@ -2082,3 +2083,34 @@ func (s *Service) utilLogoutAll(ctx *gin.Context, mid int64) (err error) {
return return
} }
func (s *Service) UtilEncryptVideosForZoneMomentVOs(ctx *gin.Context, list []*zonemomentproto.ApiZoneMomentVO) {
videoIdForUploadFail, err := apollo.GetIntValue(consts.VideoIdForUploadFail, apollo.ApolloOpts().SetNamespace("application"))
if err != nil {
logger.Error("Apollo read failed : %v", err)
}
media := &dbstruct.MediaComponent{
ImageIds: util.Int64Slice(make([]int64, 0)),
VideoIds: util.Int64Slice([]int64{int64(videoIdForUploadFail)}),
}
mediafiller.FillEntity(ctx, media)
vdi := &dbstruct.ToCVideo{}
if len(media.Videos) > 0 {
vdi = media.Videos[0]
}
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)
video.Urls = append(video.Urls, vdi.Urls...)
}
}
}
}