李昊 4 years ago
parent
commit
6199adbc61

+ 10 - 0
gx_api/GxPress/Api/GxPress.Api/AppControllers/AppPageController.cs

@@ -217,6 +217,11 @@ namespace GxPress.Api.AppControllers
             dictionary.Add(3, "课程榜");
             dictionary.Add(4, "文献头条");
             dictionary.Add(6, "试听榜");
+            var dictionaryMedia = new Dictionary<int, string>();
+            dictionaryMedia.Add(AllTypeConst.Book.GetHashCode(), "热书榜");
+            dictionaryMedia.Add(AllTypeConst.Curriculum.GetHashCode(), "课程榜");
+            dictionaryMedia.Add(AllTypeConst.Article.GetHashCode(), "文献头条");
+            dictionaryMedia.Add(AllTypeConst.Audio.GetHashCode(), "试听榜");
             var result = new List<MediaRankingResult>();
             foreach (var item in dictionary)
             {
@@ -225,6 +230,11 @@ namespace GxPress.Api.AppControllers
                 request.DataTypeValue = item.Key;
                 mediaRankingResult.Name = item.Value;
                 mediaRankingResult.RankingListResults = await mediaRepository.GetRankingListResults(request);
+                foreach (var dic in dictionaryMedia)
+                {
+                    if (dic.Value.Equals(item.Value))
+                        mediaRankingResult.MediaType = dic.Key;
+                }
                 result.Add(mediaRankingResult);
             }
             return result;

+ 5 - 0
gx_api/GxPress/Model/GxPress.Request/Media/MediaRequest.cs

@@ -250,6 +250,11 @@ namespace GxPress.Request.Media
         /// </summary>
         /// <value></value>
         public int DataTypeValue { get; set; }
+        /// <summary>
+        /// 搜查
+        /// </summary>
+        /// <value></value>
+        public string KeyWord { get; set; }
     }
     /// <summary>
     /// 

+ 2 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/Media/MediaRepository.cs

@@ -607,6 +607,8 @@ namespace GxPress.Repository.Implement.Media
             query.Select(nameof(Entity.tede2.Media.Media.CommentScore));
             query.Select(nameof(Entity.tede2.Media.Media.CreatedDate));
             query.Select(nameof(Entity.tede2.Media.Media.ReadCount));
+            if (!string.IsNullOrEmpty(request.KeyWord))
+                query.WhereLike(nameof(Entity.tede2.Media.Media.Title), $"%{request.KeyWord}%");
             //1 热搜 2热书榜 3 课程榜 4Top 100 新书 5文献头条  6试听榜 7大众热评 8Top 100 专著
             if (request.DataTypeValue > 0)
             {