Merge pull request 'feat-IRONFANS-205-Robin' (#729) from feat-IRONFANS-205-Robin into test
Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/729
This commit is contained in:
commit
56fe389cd4
|
@ -1688,6 +1688,33 @@ func (s *Service) utilGetZonePreviews(ctx *gin.Context, zid int64) (previews *db
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(imageIds) == 0 {
|
||||||
|
vzmlist := make([]*dbstruct.ZoneMoment, 0)
|
||||||
|
vzmlist, err = _DefaultZoneMoment.OpListByZid(ctx, &zonemomentproto.OpListByZidReq{
|
||||||
|
Zid: goproto.Int64(zid),
|
||||||
|
MType: goproto.Int64(consts.MediaTypeVideo),
|
||||||
|
CType: goproto.Int64(consts.ZoneMomentCType_Free),
|
||||||
|
Status: goproto.Int64(consts.ZoneMoment_Public),
|
||||||
|
Limit: 4,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("_DefaultZoneMoment OpListByZid fail, req: %v, err: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
objectMediaNum := 1 // 单个空间服务总共5个媒体类
|
||||||
|
mediaFillableList := make([]mediafiller.MediaFillable, len(vzmlist)*objectMediaNum)
|
||||||
|
for i, vo := range vzmlist {
|
||||||
|
mediaFillableList[objectMediaNum*i+0] = vo.MediaComp
|
||||||
|
}
|
||||||
|
|
||||||
|
imageIds, err = mediafiller.GetCoverIds(ctx, mediaFillableList)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("GetCoverIds fail, req: %v, err: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
previews = &dbstruct.MediaComponent{
|
previews = &dbstruct.MediaComponent{
|
||||||
ImageIds: util.Int64Slice(imageIds),
|
ImageIds: util.Int64Slice(imageIds),
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,3 +215,22 @@ func FillListInternal(ctx *gin.Context, list []MediaFillable) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetCoverIds(ctx *gin.Context, list []MediaFillable) ([]int64, error) {
|
||||||
|
coverIds := make([]int64, 0)
|
||||||
|
videoIds := make([]int64, 0)
|
||||||
|
for _, v := range list {
|
||||||
|
videoIds = append(videoIds, v.GetVideoIds()...)
|
||||||
|
}
|
||||||
|
videoMap, err := getVideoMapByIds(ctx, videoIds)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("mediafiller component getVideoMapByIds failed : %v", err)
|
||||||
|
return make([]int64, 0), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取视频封面
|
||||||
|
for _, v := range videoMap {
|
||||||
|
coverIds = append(coverIds, v.CoverId)
|
||||||
|
}
|
||||||
|
return coverIds, nil
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue