|
@@ -536,6 +536,8 @@ namespace GxPress.Repository.Implement.Media
|
|
|
query.Select(nameof(Entity.tede2.Media.Media.MediaType));
|
|
|
query.Select(nameof(Entity.tede2.Media.Media.Summary));
|
|
|
query.Select(nameof(Entity.tede2.Media.Media.CommentScore));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.CreatedDate));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.ReadCount));
|
|
|
//1 热搜 2热书榜 3 课程榜 4Top 100 新书 5文献头条 6试听榜 7大众热评 8Top 100 专著
|
|
|
if (request.DataTypeValue > 0)
|
|
|
{
|
|
@@ -584,6 +586,77 @@ namespace GxPress.Repository.Implement.Media
|
|
|
return await _repository.GetAllAsync<RankingListResult>(query);
|
|
|
}
|
|
|
/// <summary>
|
|
|
+ /// 排行榜分页
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<PagedList<RankingListResult>> GetRankingPageListResults(RankingListRequest request)
|
|
|
+ {
|
|
|
+ var result = new PagedList<RankingListResult>();
|
|
|
+ //获取媒体
|
|
|
+ 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));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.CreatedDate));
|
|
|
+ query.Select(nameof(Entity.tede2.Media.Media.ReadCount));
|
|
|
+ //1 热搜 2热书榜 3 课程榜 4Top 100 新书 5文献头条 6试听榜 7大众热评 8Top 100 专著
|
|
|
+ if (request.DataTypeValue > 0)
|
|
|
+ {
|
|
|
+ //1 热搜
|
|
|
+ if (request.DataTypeValue == RankingListConst.HotSearch.GetHashCode())
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.ReadCount));
|
|
|
+ //2热书榜
|
|
|
+ if (request.DataTypeValue == RankingListConst.ReadBook.GetHashCode())
|
|
|
+ {
|
|
|
+ query.Where(nameof(Entity.tede2.Media.Media.MediaType), ResourceTypeConst.Book.GetHashCode());
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.ReadCount));
|
|
|
+ }
|
|
|
+ //3 课程榜
|
|
|
+ if (request.DataTypeValue == RankingListConst.Article.GetHashCode())
|
|
|
+ {
|
|
|
+ query.Where(nameof(Entity.tede2.Media.Media.MediaType), ResourceTypeConst.Article.GetHashCode());
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.ReadCount));
|
|
|
+ }
|
|
|
+ //Top 100 新书
|
|
|
+ if (request.DataTypeValue == RankingListConst.NewBook.GetHashCode())
|
|
|
+ {
|
|
|
+ query.Where(nameof(Entity.tede2.Media.Media.MediaType), ResourceTypeConst.Book.GetHashCode());
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.CreatedDate));
|
|
|
+ }
|
|
|
+ //文献头条
|
|
|
+ if (request.DataTypeValue == RankingListConst.ArticleTop.GetHashCode())
|
|
|
+ {
|
|
|
+ query.Where(nameof(Entity.tede2.Media.Media.MediaType), ResourceTypeConst.Article.GetHashCode());
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.IsTop));
|
|
|
+ }
|
|
|
+ if (request.DataTypeValue == RankingListConst.Audio.GetHashCode())
|
|
|
+ {
|
|
|
+ query.Where(nameof(Entity.tede2.Media.Media.MediaType), ResourceTypeConst.Audio.GetHashCode());
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.ReadCount));
|
|
|
+ }
|
|
|
+ if (request.DataTypeValue == RankingListConst.HotComment.GetHashCode())
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.CommentScore));
|
|
|
+ if (request.DataTypeValue == RankingListConst.CollectionBook.GetHashCode())
|
|
|
+ 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);
|
|
|
+ result.Total = await _repository.CountAsync(query);
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.IsTop));
|
|
|
+ query.OrderByDesc(nameof(Entity.tede2.Media.Media.IsRecommend));
|
|
|
+ query.ForPage(request.Page, request.PerPage);
|
|
|
+ result.Items = await _repository.GetAllAsync<RankingListResult>(query);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
/// 大咖讲座
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|