fix: Social GetAllFollowers/Vloggers + Like ListLikedVideos 加 Limit(200) 防海量数据
This commit is contained in:
@@ -30,6 +30,7 @@ func (r *SocialRepository) GetAllFollowers(ctx context.Context, VloggerID uint)
|
|||||||
if err := r.db.WithContext(ctx).
|
if err := r.db.WithContext(ctx).
|
||||||
Model(&Social{}).
|
Model(&Social{}).
|
||||||
Where("vlogger_id = ?", VloggerID).
|
Where("vlogger_id = ?", VloggerID).
|
||||||
|
Limit(200).
|
||||||
Find(&relations).Error; err != nil {
|
Find(&relations).Error; err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -57,6 +58,7 @@ func (r *SocialRepository) GetAllVloggers(ctx context.Context, FollowerID uint)
|
|||||||
if err := r.db.WithContext(ctx).
|
if err := r.db.WithContext(ctx).
|
||||||
Model(&Social{}).
|
Model(&Social{}).
|
||||||
Where("follower_id = ?", FollowerID).
|
Where("follower_id = ?", FollowerID).
|
||||||
|
Limit(200).
|
||||||
Find(&relations).Error; err != nil {
|
Find(&relations).Error; err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ func (r *LikeRepository) ListLikedVideos(ctx context.Context, accountID uint) ([
|
|||||||
Joins("JOIN likes ON likes.video_id = videos.id").
|
Joins("JOIN likes ON likes.video_id = videos.id").
|
||||||
Where("likes.account_id = ?", accountID).
|
Where("likes.account_id = ?", accountID).
|
||||||
Order("likes.created_at desc").
|
Order("likes.created_at desc").
|
||||||
|
Limit(200).
|
||||||
Find(&videos).Error
|
Find(&videos).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user