chore:一些测试文件的小修改

This commit is contained in:
Leon
2025-12-16 14:35:36 +08:00
parent a93521f8ab
commit 2c9bf4cc60
4 changed files with 6 additions and 18 deletions

View File

@@ -2,7 +2,7 @@ package feed
import (
"context"
"feedsystem_video_go/internal/video" // 引入视频实体
"feedsystem_video_go/internal/video"
"time"
"gorm.io/gorm"
@@ -32,9 +32,9 @@ func (repo *FeedRepository) ListLatest(ctx context.Context, limit int, latestBef
func (repo *FeedRepository) ListLikesCount(ctx context.Context, limit int, likesCountBefore int64) ([]video.Video, error) {
var videos []video.Video
query := repo.db.WithContext(ctx).Model(&video.Video{}).
Order("like_count DESC")
Order("likes_count DESC")
if likesCountBefore > 0 {
query = query.Where("like_count < ?", likesCountBefore)
query = query.Where("likes_count < ?", likesCountBefore)
}
if err := query.Limit(limit).Find(&videos).Error; err != nil {
return nil, err