|
@@ -436,5 +436,67 @@ namespace GxPress.Repository.Implement.Media
|
|
|
query.ForPage(1, 10);
|
|
|
return await _repository.GetAllAsync<NavigationMediaResult>(query);
|
|
|
}
|
|
|
+ /// <summary>
|
|
|
+ /// 排行榜
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<IEnumerable<RankingListResult>> GetRankingListResults(RankingListRequest request)
|
|
|
+ {
|
|
|
+ //获取媒体
|
|
|
+ var query = Q.NewQuery();
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.Id));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.ImageUrls));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.Title));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.Summary));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.TeacherId));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.AutoNumber));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.Author));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.MediaType));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.Summary));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.CommentScore));
|
|
|
+ //1 热搜 2热书榜 3 课程榜 4Top 100 新书 5文献头条 6试听榜 7大众热评 8Top 100 专著
|
|
|
+ if (request.DataTypeValue > 0)
|
|
|
+ {
|
|
|
+ //1 热搜
|
|
|
+ if (request.DataTypeValue == 1)
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.ReadCount));
|
|
|
+ //2热书榜
|
|
|
+ if (request.DataTypeValue == 2)
|
|
|
+ {
|
|
|
+ query.Where(nameof(Entity.tede2.Media.Media.MediaType), 20);
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.ReadCount));
|
|
|
+ }
|
|
|
+ if (request.DataTypeValue == 3)
|
|
|
+ {
|
|
|
+ query.Where(nameof(Entity.tede2.Media.Media.MediaType), 100);
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.ReadCount));
|
|
|
+ }
|
|
|
+ if (request.DataTypeValue == 4)
|
|
|
+ {
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.CreatedDate));
|
|
|
+ }
|
|
|
+ if (request.DataTypeValue == 5)
|
|
|
+ {
|
|
|
+ query.Where(nameof(Entity.tede2.Media.Media.MediaType), 100);
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.ReadCount));
|
|
|
+ }
|
|
|
+ if (request.DataTypeValue == 6)
|
|
|
+ {
|
|
|
+ query.Where(nameof(Entity.tede2.Media.Media.MediaType), 40);
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.ReadCount));
|
|
|
+ }
|
|
|
+ if (request.DataTypeValue == 7)
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.CommentScore));
|
|
|
+ if (request.DataTypeValue == 8)
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.CollectCount));
|
|
|
+ }
|
|
|
+ query.Where(nameof(Entity.tede2.Media.Media.IsChecked), true);
|
|
|
+ query.Where(nameof(Entity.tede2.Media.Media.IsDelete), false);
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.IsTop));
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.IsRecommend));
|
|
|
+ query.ForPage(request.Page, request.PerPage);
|
|
|
+ return await _repository.GetAllAsync<RankingListResult>(query);
|
|
|
+ }
|
|
|
}
|
|
|
}
|