李昊 пре 4 година
родитељ
комит
a5528a9c8d

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

@@ -63,6 +63,11 @@ namespace GxPress.Result.AppChannel
         /// <value></value>
 
         public int TypeValue { get; set; }
+        /// <summary>
+        /// 媒体集合
+        /// </summary>
+        /// <value></value>
+        public IEnumerable<int> MediaIds { get; set; }
     }
     /// <summary>
     /// 导航类别

+ 3 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/AppChannel/ChannelCategoryMediaRepository.cs

@@ -39,11 +39,13 @@ namespace GxPress.Repository.Implement.AppChannel
         /// 查询 获取MediaId
         /// </summary>
         /// <returns></returns>
-        public async Task<IEnumerable<int>> GetAllAsync(int categoryId)
+        /// <returns>isCategory</returns>
+        public async Task<IEnumerable<int>> GetAllAsync(int categoryId,bool isCategory=true)
         {
             var query = Q.NewQuery();
             query.Select(nameof(Entity.tede2.AppChannel.ChannelCategoryMedia.MediaId));
             query.Where(nameof(Entity.tede2.AppChannel.ChannelCategoryMedia.ChannelCategoryId), categoryId);
+             query.Where(nameof(Entity.tede2.AppChannel.ChannelCategoryMedia.IsCategory), isCategory);
             var result = await _repository.GetAllAsync<int>(query);
             return result;
         }

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Interface/AppChannel/IChannelCategoryMediaRepository.cs

@@ -17,7 +17,7 @@ namespace GxPress.Repository.Interface.AppChannel
         /// 查询 获取MediaId
         /// </summary>
         /// <returns></returns>
-        Task<IEnumerable<int>> GetAllAsync(int categoryId);
+        Task<IEnumerable<int>> GetAllAsync(int categoryId,bool isCategory=true);
         /// <summary>
         /// 删除
         /// </summary>

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

@@ -86,6 +86,19 @@ namespace GxPress.Service.Implement.AppChannel
             return await mediaRepository.GetAppChannelsAsync(request);
         }
 
-
+        /// <summary>
+        /// 查询
+        /// </summary>
+        /// <returns></returns>
+        public async Task<IEnumerable<AppChannelResult>> GetAllAsync(AppChannelConst channelTypeValue)
+        {
+            var result = await appChannelRepository.GetAllAsync(channelTypeValue);
+            foreach (var item in result)
+            {
+                if (item.TypeValue != 1)
+                    item.MediaIds = await channelCategoryMediaRepository.GetAllAsync(item.Id, false);
+            }
+            return result;
+        }
     }
 }