From 5ccad2cbca96745608f6225e6fd68664b639912d Mon Sep 17 00:00:00 2001 From: Leufolium Date: Fri, 15 Mar 2024 21:18:11 +0800 Subject: [PATCH] by Robin at 20240315 --- app/mix/service/utilservice.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/app/mix/service/utilservice.go b/app/mix/service/utilservice.go index f7c01bc5..797eb8f8 100644 --- a/app/mix/service/utilservice.go +++ b/app/mix/service/utilservice.go @@ -828,7 +828,6 @@ func (s *Service) utilGetStreamerRecommListVO(ctx *gin.Context, recommlist []int // 获取用户游标 offset := int64(0) recommListLength := int64(len(recommlist)) - upperBound := int64(consts.StreamerRecommThroughput) offset, bottomFlag, err := s.utilGetStreamerRecommlistOffsetAndBottomeFlag(ctx, recommListLength, mid, opType) if err != nil { @@ -839,10 +838,13 @@ func (s *Service) utilGetStreamerRecommListVO(ctx *gin.Context, recommlist []int return make([]*streamerproto.ApiListExtVO, 0), nil } - surplusVolume := recommListLength - offset - - if surplusVolume < consts.StreamerRecommThroughput { - upperBound = surplusVolume + // 向下操作,去尾 + upperBound := int64(consts.StreamerRecommThroughput) + if opType == consts.Recomm_Down { + surplusVolume := recommListLength - offset + if surplusVolume < consts.StreamerRecommThroughput { + upperBound = surplusVolume + } } // 根据用户游标查询得到结果 @@ -1109,7 +1111,6 @@ func (s *Service) utilGetMomentRecommListIds(ctx *gin.Context, mid int64, opType // 获取用户游标 offset := int64(0) - upperBound := throughput // 获取游标和是否已触底标志 offset, bottomFlag, err := s.utilGetMomentRecommlistOffsetAndBottomeFlag(ctx, mid, opType, recommListLength, throughput) @@ -1121,10 +1122,13 @@ func (s *Service) utilGetMomentRecommListIds(ctx *gin.Context, mid int64, opType return make([]int64, 0), nil } - surplusVolume := recommListLength - offset - - if surplusVolume < throughput { - upperBound = surplusVolume + // 向下操作,去尾 + upperBound := throughput + if opType == consts.Recomm_Down { + surplusVolume := recommListLength - offset + if surplusVolume < throughput { + upperBound = surplusVolume + } } // 根据用户游标得到待查询ids