李昊 4 years ago
parent
commit
3a515b1749

+ 11 - 2
gx_api/GxPress/Api/GxPress.Api/AppControllers/AppPageController.cs

@@ -309,13 +309,22 @@ namespace GxPress.Api.AppControllers
         /// <returns></returns>
         [HttpPost("channel-category-media")]
         [AllowAnonymous]
-        public async Task<object> GetChannelCategoryMediaPageAsync(AppChannelSearchRequest request)
+        public async Task<PagedList<MediaChannelCategoryResult>> GetChannelCategoryMediaPageAsync(AppChannelSearchRequest request)
         {
+            var result = new PagedList<MediaChannelCategoryResult>();
             if (request.CategoryId > 0)
             {
                 if (await appChannelService.IsChildrenAsync(request.CategoryId))
                 {
-                    return await appChannelService.GetAllByParentIdAsync(request);
+                    var categroys = await appChannelService.GetAllByParentIdAsync(request);
+                    result.Total = categroys.Total;
+                    var list = new List<MediaChannelCategoryResult>();
+                    foreach (var item in categroys.Items)
+                    {
+                        list.Add(new MediaChannelCategoryResult { Id = item.Id, Name = item.Name, ExpandName = item.ExpandName, IsCategory = true });
+                    }
+                    result.Items = list;
+                    return result;
                 }
             }
             return await appChannelService.GetChannelCategoryMediaPageAsync(request);

+ 82 - 0
gx_api/GxPress/Model/GxPress.Result/AppChannel/AppChannelResult.cs

@@ -1,3 +1,4 @@
+using System;
 using System.Collections.Generic;
 
 namespace GxPress.Result.AppChannel
@@ -118,4 +119,85 @@ namespace GxPress.Result.AppChannel
         /// <value></value>
         public bool IsCategory { get; set; }
     }
+    /// <summary>
+    /// 大咖讲座
+    /// </summary>
+    public class MediaChannelCategoryResult
+    {
+        /// <summary>
+        /// 评分
+        /// </summary>
+        /// <value></value>
+        public decimal CommentScore { get; set; }
+        public bool IsCategory { get; set; }
+        /// <summary>
+        /// 简介
+        /// </summary>
+
+        public string Summary { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <value></value>
+        public int Id { get; set; }
+        /// <summary>
+        /// 标题
+        /// </summary>
+
+        public string Title { get; set; }
+
+        /// <summary>
+        /// 标题图片
+        /// </summary>
+
+        public string ImageUrls { get; set; }
+        /// <summary>
+        /// 出版社
+        /// </summary>
+        /// <value></value>
+        public string Press { get; set; }
+
+        /// <summary>
+        /// 作者
+        /// </summary>
+
+        public string Author { get; set; }
+        /// <summary>
+        /// 阅读量
+        /// </summary>
+        /// <value></value>
+        public int ReadCount { get; set; }
+        /// <summary>
+        /// 创建时间
+        /// </summary>
+        /// <value></value>
+        public DateTime? CreatedDate { get; set; }
+        /// <summary>
+        /// 时长
+        /// </summary>
+        /// <value></value>
+        public string Duration { get; set; }
+        /// <summary>
+        /// 收藏数量
+        /// </summary>
+        /// <value></value>
+        public int CollectCount { get; set; }
+
+        /// <summary>
+        /// 媒体类型
+        /// </summary>
+        public int MediaType { get; set; }
+        /// <summary>
+        /// 名称
+        /// </summary>
+        /// <value></value>
+
+        public string Name { get; set; }
+        /// <summary>
+        /// 扩展名称
+        /// </summary>
+        /// <value></value>
+
+        public string ExpandName { get; set; }
+    }
 }

+ 0 - 1
gx_api/GxPress/Model/GxPress.Result/Media/MediaResult.cs

@@ -490,7 +490,6 @@ namespace GxPress.Result.Media
     /// </summary>
     public class MediaCathedraResult
     {
-        public bool IsCategory{get;set;}
         /// <summary>
         /// 简介
         /// </summary>

+ 5 - 3
gx_api/GxPress/Repository/GxPress.Repository.Implement/Media/MediaRepository.cs

@@ -17,6 +17,7 @@ using GxPress.EnumConst;
 using GxPress.Request.ArticleGroup;
 using Dapper;
 using GxPress.Request.AppChannel;
+using GxPress.Result.AppChannel;
 
 namespace GxPress.Repository.Implement.Media
 {
@@ -915,9 +916,9 @@ namespace GxPress.Repository.Implement.Media
         /// app频道
         /// </summary>
         /// <returns></returns>
-        public async Task<PagedList<MediaCathedraResult>> GetAppChannelsAsync(AppChannelSearchRequest request)
+        public async Task<PagedList<MediaChannelCategoryResult>> GetAppChannelsAsync(AppChannelSearchRequest request)
         {
-            var resut = new PagedList<MediaCathedraResult>();
+            var resut = new PagedList<MediaChannelCategoryResult>();
             var query = Q.NewQuery();
             query.Select(nameof(Entity.tede2.Media.Media.Id));
             query.Select(nameof(Entity.tede2.Media.Media.ImageUrls));
@@ -927,6 +928,7 @@ namespace GxPress.Repository.Implement.Media
             query.Select(nameof(Entity.tede2.Media.Media.ReadCount));
             query.Select(nameof(Entity.tede2.Media.Media.CreatedDate));
             query.Select(nameof(Entity.tede2.Media.Media.Summary));
+            query.Select(nameof(Entity.tede2.Media.Media.CommentScore));
             query.WhereIn(nameof(Entity.tede2.Media.Media.Id), request.Ids);
             if (!string.IsNullOrEmpty(request.KeyWord))
                 query.WhereLike(nameof(Entity.tede2.Media.Media.Title), $"%{request.KeyWord}%");
@@ -939,7 +941,7 @@ namespace GxPress.Repository.Implement.Media
             else
                 query.OrderByDesc(nameof(Entity.tede2.Media.Media.CreatedDate));
             query.ForPage(request.Page, request.PerPage);
-            resut.Items = await _repository.GetAllAsync<MediaCathedraResult>(query);
+            resut.Items = await _repository.GetAllAsync<MediaChannelCategoryResult>(query);
             foreach (var item in resut.Items)
                 item.ImageUrls = StringUtils.AddDomain(item.ImageUrls);
             return resut;

+ 2 - 1
gx_api/GxPress/Repository/GxPress.Repository.Interface/Media/IMediaRepository.cs

@@ -5,6 +5,7 @@ using GxPress.Common.Page;
 using GxPress.Request.AppChannel;
 using GxPress.Request.ArticleGroup;
 using GxPress.Request.Media;
+using GxPress.Result.AppChannel;
 using GxPress.Result.Media;
 
 namespace GxPress.Repository.Interface.Media
@@ -131,6 +132,6 @@ namespace GxPress.Repository.Interface.Media
         /// app频道
         /// </summary>
         /// <returns></returns>
-        Task<PagedList<MediaCathedraResult>> GetAppChannelsAsync(AppChannelSearchRequest request);
+        Task<PagedList<MediaChannelCategoryResult>> GetAppChannelsAsync(AppChannelSearchRequest request);
     }
 }

+ 1 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/AppChannel/AppChannelService.cs

@@ -78,7 +78,7 @@ namespace GxPress.Service.Implement.AppChannel
         /// 根据app频道分类id获取媒体分页数据
         /// </summary>
         /// <returns></returns>
-        public async Task<PagedList<MediaCathedraResult>> GetChannelCategoryMediaPageAsync(AppChannelSearchRequest request)
+        public async Task<PagedList<MediaChannelCategoryResult>> GetChannelCategoryMediaPageAsync(AppChannelSearchRequest request)
         {
             var appChannel = await appChannelRepository.GetAsync(request.ChannelId);
             //获取标签

+ 1 - 1
gx_api/GxPress/Service/GxPress.Service.Interface/AppChannel/IAppChannelService.cs

@@ -24,7 +24,7 @@ namespace GxPress.Service.Interface.AppChannel
         /// 根据app频道分类id获取媒体分页数据
         /// </summary>
         /// <returns></returns>
-        Task<PagedList<MediaCathedraResult>> GetChannelCategoryMediaPageAsync(AppChannelSearchRequest request);
+        Task<PagedList<MediaChannelCategoryResult>> GetChannelCategoryMediaPageAsync(AppChannelSearchRequest request);
 
         /// <summary>
         /// 查询