李昊 4 years ago
parent
commit
80d100aaef
19 changed files with 442 additions and 93 deletions
  1. 73 0
      gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminSpecialLabelController.cs
  2. 7 3
      gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminUtilsController.cs
  3. 5 2
      gx_api/GxPress/Api/GxPress.Api/WebControllers/NavigationController.cs
  4. 46 0
      gx_api/GxPress/Model/GxPress.Entity/SystemLabel/SpecialLabel.cs
  5. 1 1
      gx_api/GxPress/Model/GxPress.Entity/SystemLabel/SystemLabel.cs
  6. 1 1
      gx_api/GxPress/Model/GxPress.EnumConst/VipTypeConst.cs
  7. 15 0
      gx_api/GxPress/Model/GxPress.Result/Navigation/NavigationResult.cs
  8. 21 0
      gx_api/GxPress/Repository/GxPress.Repository.Implement/Media/MediaRepository.cs
  9. 0 78
      gx_api/GxPress/Repository/GxPress.Repository.Implement/Navigation/NavigationRepository.cs
  10. 9 1
      gx_api/GxPress/Repository/GxPress.Repository.Implement/SlideRepository.cs
  11. 91 0
      gx_api/GxPress/Repository/GxPress.Repository.Implement/SpecialLabel/SpecialLabelRepository.cs
  12. 5 1
      gx_api/GxPress/Repository/GxPress.Repository.Implement/SystemLabel/SystemLabelRepository.cs
  13. 2 0
      gx_api/GxPress/Repository/GxPress.Repository.Interface/ISlideRepository.cs
  14. 3 1
      gx_api/GxPress/Repository/GxPress.Repository.Interface/Media/IMediaRepository.cs
  15. 1 5
      gx_api/GxPress/Repository/GxPress.Repository.Interface/Navigation/INavigationRepository.cs
  16. 40 0
      gx_api/GxPress/Repository/GxPress.Repository.Interface/SpecialLabel/ISpecialLabelRepository.cs
  17. 1 0
      gx_api/GxPress/Repository/GxPress.Repository.Interface/SystemLabel/ISystemLabelRepository.cs
  18. 107 0
      gx_api/GxPress/Service/GxPress.Service.Implement/Navigation/NavigationService.cs
  19. 14 0
      gx_api/GxPress/Service/GxPress.Service.Interface/Navigation/INavigationService.cs

+ 73 - 0
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminSpecialLabelController.cs

@@ -0,0 +1,73 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using GxPress.Repository.Interface.SpecialLabel;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+
+namespace GxPress.Api.AdminControllers
+{
+    /// <summary>
+    /// 特使标签数据
+    /// </summary>
+    [Route("api/admin/special-label")]
+    [ApiController]
+    [Authorize]
+    public class AdminSpecialLabelController : Controller
+    {
+        private readonly ISpecialLabelRepository specialLabelRepository;
+        public AdminSpecialLabelController(ISpecialLabelRepository specialLabelRepository)
+        {
+            this.specialLabelRepository = specialLabelRepository;
+        }
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<bool> InsertAsync(Entity.SystemLabel.SpecialLabel model)
+        {
+            return await specialLabelRepository.InsertAsync(model) > 0;
+        }
+        /// <summary>
+        /// 修改
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPut]
+        public async Task<bool> UpdateAsync(Entity.SystemLabel.SpecialLabel model)
+        {
+            return await specialLabelRepository.UpdateAsync(model);
+        }
+        /// <summary>
+        /// 获取
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpGet("{id}")]
+        public async Task<Entity.SystemLabel.SpecialLabel> GetAsync(int id)
+        {
+            return await specialLabelRepository.GetAsync(id);
+        }
+        /// <summary>
+        /// 删除
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpDelete]
+        public async Task<bool> DeleteAsync(int id)
+        {
+            return await specialLabelRepository.DeleteAsync(id);
+        }
+        /// <summary>
+        /// 获取类型下的数据
+        /// </summary>
+        /// <param name="typeValue"></param>
+        /// <returns></returns>
+        [HttpGet("list/{typeValue}")]
+        public async Task<IEnumerable<Entity.SystemLabel.SpecialLabel>> GetAllAsync(int typeValue)
+        {
+            return await specialLabelRepository.GetAllAsync(typeValue);
+        }
+    }
+}

File diff suppressed because it is too large
+ 7 - 3
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminUtilsController.cs


+ 5 - 2
gx_api/GxPress/Api/GxPress.Api/WebControllers/NavigationController.cs

@@ -2,6 +2,7 @@ using System.Collections.Generic;
 using System.Threading.Tasks;
 using GxPress.Repository.Interface.Navigation;
 using GxPress.Result.Navigation;
+using GxPress.Service.Interface.Navigation;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
 
@@ -16,9 +17,11 @@ namespace GxPress.Api.WebControllers
     public class NavigationController : Controller
     {
         private readonly INavigationRepository navigationRepository;
-        public NavigationController(INavigationRepository navigationRepository)
+        private readonly INavigationService navigationService;
+        public NavigationController(INavigationRepository navigationRepository,INavigationService navigationService)
         {
             this.navigationRepository = navigationRepository;
+            this.navigationService=navigationService;
         }
         /// <summary>
         /// 获取导航栏数据
@@ -28,7 +31,7 @@ namespace GxPress.Api.WebControllers
         [AllowAnonymous]
         public async Task<MiddleLableResult> GetNavigationResults(int id)
         {
-            return await navigationRepository.GetNavigationResults(id);
+            return await navigationService.GetNavigationResults(id);
         }
 
         /// <summary>

+ 46 - 0
gx_api/GxPress/Model/GxPress.Entity/SystemLabel/SpecialLabel.cs

@@ -0,0 +1,46 @@
+using Datory.Annotations;
+
+namespace GxPress.Entity.SystemLabel
+{
+    /// <summary>
+    /// 特殊标签
+    /// </summary>
+    [DataTable("tede_special_label")]
+    public class SpecialLabel : Datory.Entity
+    {
+        /// <summary>
+        /// 标题
+        /// </summary>
+        [DataColumn]
+        public string Title { get; set; }
+        /// <summary>
+        /// 标题图片
+        /// </summary>
+        [DataColumn]
+        public string ImageUrls { get; set; }
+        /// <summary>
+        /// 榜单 130 示范客厅 140  品牌专区1 150 品牌专区2 160 直播170
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int TypeValue { get; set; }
+        /// <summary>
+        /// 备注
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string Remark { get; set; }
+        /// <summary>
+        /// 类型数据
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int DataTypeValue { get; set; }
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int Sort { get; set; }
+    }
+}

+ 1 - 1
gx_api/GxPress/Model/GxPress.Entity/SystemLabel/SystemLabel.cs

@@ -68,7 +68,7 @@ namespace GxPress.Entity.SystemLabel
         [DataColumn]
         public string ActionUrl { get; set; }
         /// <summary>
-        /// 资源类型
+        /// 资源类型 文章100书籍20,课程30,音频40,期刊50,视频60,名栏90,公众号110,刊期120,榜单130,示范课堂140,品牌专区1(150),品牌专区2(160)
         /// </summary>
         /// <value></value>
         [DataColumn]

+ 1 - 1
gx_api/GxPress/Model/GxPress.EnumConst/VipTypeConst.cs

@@ -52,7 +52,7 @@ namespace GxPress.EnumConst
         Vip = 2,
     }
     /// <summary>
-    /// 资源类型 文章100书籍20,课程30,音频40,期刊50,视频60,名栏90,公众号110,刊期120
+    /// 资源类型 文章100书籍20,课程30,音频40,期刊50,视频60,名栏90,公众号110,刊期120 ,榜单 130 示范客厅 140  品牌专区1 150 品牌专区2 160
     /// </summary>
     public enum ResourceTypeConst
     {

+ 15 - 0
gx_api/GxPress/Model/GxPress.Result/Navigation/NavigationResult.cs

@@ -84,6 +84,16 @@ namespace GxPress.Result.Navigation
         /// <value></value>
         public List<NavigationMediaResult> MediaResults { get; set; }
 
+        /// <summary>
+        ///   特殊 130,示范课堂140,品牌专区1(150),品牌专区2(160)
+        /// </summary>
+        /// <value></value>
+        public IEnumerable<Entity.SystemLabel.SpecialLabel> SpecialLabelResults { get; set; }
+        /// <summary>
+        /// 是否特殊
+        /// </summary>
+        /// <value></value>
+        public bool IsSpecial { get; set; }
     }
     /// <summary>
     /// 中间页面
@@ -143,6 +153,11 @@ namespace GxPress.Result.Navigation
         /// </summary>
         /// <value></value>
         public IEnumerable<Entity.Slide> Sildes { get; set; }
+        /// <summary>
+        /// 是否特殊
+        /// </summary>
+        /// <value></value>
+        public bool IsSpecial { get; set; }
     }
     /// <summary>
     /// 导航数据的显示

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

@@ -361,5 +361,26 @@ namespace GxPress.Repository.Implement.Media
             var result = await _repository.GetAsync(Q.Where(nameof(Entity.tede2.Media.Media.Id), mediaId).Where(nameof(Entity.tede2.Media.Media.IsChecked), true).Where(nameof(Entity.tede2.Media.Media.IsDelete), false));
             return _mapper.Map<VideoMediaResult>(result);
         }
+
+        public async Task<IEnumerable<NavigationMediaResult>> GetNavigationMediaResults(IEnumerable<int> mediaLables)
+        {
+            //获取媒体
+            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.WhereIn(nameof(Entity.tede2.Media.Media.LableId), mediaLables);
+            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(1, 10);
+            return await _repository.GetAllAsync<NavigationMediaResult>(query);
+        }
     }
 }

+ 0 - 78
gx_api/GxPress/Repository/GxPress.Repository.Implement/Navigation/NavigationRepository.cs

@@ -144,83 +144,5 @@ namespace GxPress.Repository.Implement.Navigation
             }
             return items;
         }
-        /// <summary>
-        /// 获取导航栏数据
-        /// </summary>
-        /// <returns></returns>
-        public async Task<MiddleLableResult> GetNavigationResults(int navigationId)
-        {
-            var result = new MiddleLableResult();
-            var navigation = await GetAsync(navigationId);
-            if (navigation.MiddleLableId > 0)
-            {
-                //获取中间页面
-                var middleLable = await _middleLableRepository.GetAsync(navigation.MiddleLableId);
-                if (string.IsNullOrEmpty(middleLable.LabelId))
-                    return result;
-                result = _mapper.Map<MiddleLableResult>(middleLable);
-                result.NavigationLabelMediaResults = new List<NavigationLabelMediaResult>();
-                //获取轮播
-                if (middleLable.IsSlide)
-                {
-                    if (result.IsSlide)
-                    {
-                        result.Sildes = await slideRepository.GetAllAsync(Q.Where(nameof(Entity.Slide.TypeId), result.TypeId).Where(nameof(Entity.Slide.IsDisable), false).OrderByDesc(nameof(Entity.Slide.Sort)));
-                        foreach (var item in result.Sildes)
-                        {
-                            item.ImageUrl = StringUtils.AddDomain(item.ImageUrl);
-                        }
-                    }
-
-                }
-                //获取标签
-                var systemLabels = await _systemLabelRepository.GetAllAsync(Q.WhereIn(nameof(Entity.SystemLabel.SystemLabel.Id), StringUtils.StringCollectionToIntList(middleLable.LabelId)));
-                foreach (var item in systemLabels)
-                {
-                    var navigationLabelMediaResult = new NavigationLabelMediaResult()
-                    {
-                        Id = item.Id,
-                        Sort = item.Sort,
-                        StyleType = item.StyleType,
-                        ActionUrl = item.ActionUrl,
-                        ControllerUrl = item.ControllerUrl,
-                        IsPage = item.IsPage,
-                        IsSkip = item.IsSkip,
-                        LabelName = item.LabelName,
-                        ResourceType = item.ResourceType,
-                        LabelNameDescribe = item.LabelNameDescribe,
-                        Remark = item.Remark
-                    };
-                    //获取媒体标签
-                    var mediaLables = await _mediaLableRepository.GetAllAsync<int>(Q.Select(nameof(Entity.tede2.Media.MediaLable.MediaId)).Where(nameof(Entity.tede2.Media.MediaLable.LableId), item.Id));
-                    //获取媒体
-                    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.WhereIn(nameof(Entity.tede2.Media.Media.Id), mediaLables);
-                    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(1, 10);
-                    var medias = await _mediaRepository.GetAllAsync<NavigationMediaResult>(query);
-                    navigationLabelMediaResult.MediaResults = medias.ToList();
-                    foreach (var itemMedia in navigationLabelMediaResult.MediaResults)
-                    {
-                        itemMedia.ImageUrls = StringUtils.AddDomain(itemMedia.ImageUrls);
-                    }
-                    result.NavigationLabelMediaResults.Add(navigationLabelMediaResult);
-                }
-            }
-            return result;
-        }
-
-
     }
 }

+ 9 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/SlideRepository.cs

@@ -57,7 +57,15 @@ namespace GxPress.Repository.Implement
             result.Items = slides;
             return result;
         }
-
+        public async Task<IEnumerable<Slide>> GetListAsync(int typeId)
+        {
+            var query = Q.NewQuery();
+            if (typeId > 0)
+                query.Where(nameof(Slide.TypeId), typeId);
+            query.Where(nameof(Entity.Slide.IsDisable), false);
+            var slides = await _repository.GetAllAsync(query.OrderBy(nameof(Slide.Sort)));
+            return slides;
+        }
         /// <summary>
         /// 添加
         /// </summary>

+ 91 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/SpecialLabel/SpecialLabelRepository.cs

@@ -0,0 +1,91 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using AutoMapper;
+using Datory;
+using GxPress.Common.AppOptions;
+using GxPress.Common.Tools;
+using GxPress.Repository.Interface.SpecialLabel;
+using Microsoft.Extensions.Options;
+
+namespace GxPress.Repository.Implement.SpecialLabel
+{
+    /// <summary>
+    /// 特殊标签管理
+    /// </summary>
+    public class SpecialLabelRepository : ISpecialLabelRepository
+    {
+        private readonly Repository<Entity.SystemLabel.SpecialLabel> _repository;
+        private readonly IMapper _mapper;
+        public SpecialLabelRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
+        {
+            var databaseType =
+                StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
+            var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
+            _repository = new Repository<Entity.SystemLabel.SpecialLabel>(database);
+            _mapper = mapper;
+        }
+        public IDatabase Database => _repository.Database;
+        public string TableName => _repository.TableName;
+        public List<TableColumn> TableColumns => _repository.TableColumns;
+
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public async Task<int> InsertAsync(Entity.SystemLabel.SpecialLabel model)
+        {
+            return await _repository.InsertAsync(model);
+        }
+        /// <summary>
+        /// 修改
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public async Task<bool> UpdateAsync(Entity.SystemLabel.SpecialLabel model)
+        {
+            var specialLabel = await GetAsync(model.Id);
+            if (!string.IsNullOrEmpty(model.ImageUrls))
+                specialLabel.ImageUrls = model.ImageUrls;
+            if (!string.IsNullOrEmpty(model.Remark))
+                specialLabel.Remark = model.Remark;
+            if (model.Sort > 0)
+                specialLabel.Sort = model.Sort;
+            if (!string.IsNullOrEmpty(model.Title))
+                specialLabel.Title = model.Title;
+            if (model.TypeValue > 0)
+                specialLabel.TypeValue = model.TypeValue;
+            return await _repository.UpdateAsync(specialLabel);
+        }
+        /// <summary>
+        /// 获取
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<Entity.SystemLabel.SpecialLabel> GetAsync(int id)
+        {
+            return await _repository.GetAsync(id);
+        }
+        /// <summary>
+        /// 删除
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<bool> DeleteAsync(int id)
+        {
+            return await _repository.DeleteAsync(id);
+        }
+        /// <summary>
+        /// 获取类型下的数据
+        /// </summary>
+        /// <param name="typeValue"></param>
+        /// <returns></returns>
+        public async Task<IEnumerable<Entity.SystemLabel.SpecialLabel>> GetAllAsync(int typeValue)
+        {
+            var query = Q.NewQuery();
+            query.Where(nameof(Entity.SystemLabel.SpecialLabel.TypeValue), typeValue);
+            query.OrderByDesc(nameof(Entity.SystemLabel.SpecialLabel.Sort)).Take(8);
+            return await _repository.GetAllAsync(query);
+        }
+    }
+}

+ 5 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/SystemLabel/SystemLabelRepository.cs

@@ -80,7 +80,11 @@ namespace GxPress.Repository.Implement.SystemLabel
 
         public async Task<IEnumerable<Entity.SystemLabel.SystemLabel>> GetAllAsync()
         {
-            return await _repository.GetAllAsync(Q.Where(nameof(Entity.Navigations.Navigation.IsDisable), false).OrderByDesc(nameof(Entity.Navigations.Navigation.Sort)));
+            return await _repository.GetAllAsync(Q.Where(nameof(Entity.SystemLabel.SystemLabel.IsDisable), false).OrderByDesc(nameof(Entity.Navigations.Navigation.Sort)));
+        }
+        public async Task<IEnumerable<Entity.SystemLabel.SystemLabel>> GetAllAsync(List<int> ids)
+        {
+            return await _repository.GetAllAsync(Q.WhereIn(nameof(Entity.SystemLabel.SystemLabel.Id), ids));
         }
     }
 }

+ 2 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/ISlideRepository.cs

@@ -25,5 +25,7 @@ namespace GxPress.Repository.Interface
         Task<Slide> EditAsync(Slide request);
 
         Task<bool> DeleteAsync(int id);
+
+        Task<IEnumerable<Slide>> GetListAsync(int typeId);
     }
 }

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

@@ -1,4 +1,5 @@
-using System.Threading.Tasks;
+using System.Collections.Generic;
+using System.Threading.Tasks;
 using Datory;
 using GxPress.Common.Page;
 using GxPress.Request.Media;
@@ -41,5 +42,6 @@ namespace GxPress.Repository.Interface.Media
         /// <param name="mediaId"></param>
         /// <returns></returns>
         Task<VideoMediaResult> GetVideoMediaResultAsync(int mediaId);
+        Task<IEnumerable<NavigationMediaResult>> GetNavigationMediaResults(IEnumerable<int> mediaLables);
     }
 }

+ 1 - 5
gx_api/GxPress/Repository/GxPress.Repository.Interface/Navigation/INavigationRepository.cs

@@ -18,10 +18,6 @@ namespace GxPress.Repository.Interface.Navigation
         Task<bool> UpdateAsync(SqlKata.Query query);
 
         Task<IEnumerable<NavigationResult>> GetAllAsync(int terminal);
-        /// <summary>
-        /// 获取导航栏数据
-        /// </summary>
-        /// <returns></returns>
-        Task<MiddleLableResult> GetNavigationResults(int navigationId);
+
     }
 }

+ 40 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/SpecialLabel/ISpecialLabelRepository.cs

@@ -0,0 +1,40 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Datory;
+
+namespace GxPress.Repository.Interface.SpecialLabel
+{
+    public interface ISpecialLabelRepository : IRepository
+    {
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        Task<int> InsertAsync(Entity.SystemLabel.SpecialLabel model);
+        /// <summary>
+        /// 修改
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        Task<bool> UpdateAsync(Entity.SystemLabel.SpecialLabel model);
+        /// <summary>
+        /// 获取
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        Task<Entity.SystemLabel.SpecialLabel> GetAsync(int id);
+        /// <summary>
+        /// 删除
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        Task<bool> DeleteAsync(int id);
+        /// <summary>
+        /// 获取类型下的数据
+        /// </summary>
+        /// <param name="typeValue"></param>
+        /// <returns></returns>
+        Task<IEnumerable<Entity.SystemLabel.SpecialLabel>> GetAllAsync(int typeValue);
+    }
+}

+ 1 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/SystemLabel/ISystemLabelRepository.cs

@@ -15,5 +15,6 @@ namespace GxPress.Repository.Interface.SystemLabel
 
         Task<bool> UpdateAsync(SystemLabelUpRequest note);
         Task<IEnumerable<Entity.SystemLabel.SystemLabel>> GetAllAsync();
+        Task<IEnumerable<Entity.SystemLabel.SystemLabel>> GetAllAsync(List<int> ids);
     }
 }

+ 107 - 0
gx_api/GxPress/Service/GxPress.Service.Implement/Navigation/NavigationService.cs

@@ -0,0 +1,107 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using AutoMapper;
+using GxPress.Common.Tools;
+using GxPress.Repository.Interface;
+using GxPress.Repository.Interface.Media;
+using GxPress.Repository.Interface.Navigation;
+using GxPress.Repository.Interface.SpecialLabel;
+using GxPress.Repository.Interface.SystemLabel;
+using GxPress.Result.Navigation;
+using GxPress.Service.Interface.Navigation;
+
+namespace GxPress.Service.Implement.Navigation
+{
+    public class NavigationService : INavigationService
+    {
+        private readonly INavigationRepository _navigationrepository;
+        private readonly IMapper _mapper;
+        private readonly IMiddleLableRepository _middleLableRepository;
+        private readonly ISystemLabelRepository _systemLabelRepository;
+        private readonly IMediaRepository _mediaRepository;
+        private readonly IMediaLableRepository _mediaLableRepository;
+        private readonly ISlideRepository slideRepository;
+        private readonly ISpecialLabelRepository specialLabelRepository;
+
+        public NavigationService(INavigationRepository _repository, IMapper _mapper, IMiddleLableRepository _middleLableRepository, ISystemLabelRepository _systemLabelRepository, IMediaRepository _mediaRepository, IMediaLableRepository _mediaLableRepository, ISlideRepository slideRepository, ISpecialLabelRepository specialLabelRepository)
+        {
+            this._navigationrepository = _repository;
+            this._middleLableRepository = _middleLableRepository;
+            this._systemLabelRepository = _systemLabelRepository;
+            this._mediaRepository = _mediaRepository;
+            this._mediaLableRepository = _mediaLableRepository;
+            this.slideRepository = slideRepository;
+            this._mapper = _mapper;
+            this.specialLabelRepository = specialLabelRepository;
+        }
+        /// <summary>
+        /// 获取导航栏数据
+        /// </summary>
+        /// <returns></returns>
+        public async Task<MiddleLableResult> GetNavigationResults(int navigationId)
+        {
+            var result = new MiddleLableResult();
+            var navigation = await _navigationrepository.GetAsync(navigationId);
+            if (navigation.MiddleLableId > 0)
+            {
+                //获取中间页面
+                var middleLable = await _middleLableRepository.GetAsync(navigation.MiddleLableId);
+                if (string.IsNullOrEmpty(middleLable.LabelId))
+                    return result;
+                result = _mapper.Map<MiddleLableResult>(middleLable);
+                result.NavigationLabelMediaResults = new List<NavigationLabelMediaResult>();
+                //获取轮播
+                if (middleLable.IsSlide)
+                {
+                    if (result.IsSlide)
+                    {
+                        result.Sildes = await slideRepository.GetListAsync(result.TypeId);
+                        foreach (var item in result.Sildes)
+                            item.ImageUrl = StringUtils.AddDomain(item.ImageUrl);
+                    }
+                }
+                //获取标签
+                var systemLabels = await _systemLabelRepository.GetAllAsync(StringUtils.StringCollectionToIntList(middleLable.LabelId).ToList());
+                foreach (var item in systemLabels)
+                {
+                    //获取常规数据
+                    var navigationLabelMediaResult = new NavigationLabelMediaResult()
+                    {
+                        Id = item.Id,
+                        Sort = item.Sort,
+                        StyleType = item.StyleType,
+                        ActionUrl = item.ActionUrl,
+                        ControllerUrl = item.ControllerUrl,
+                        IsPage = item.IsPage,
+                        IsSkip = item.IsSkip,
+                        LabelName = item.LabelName,
+                        ResourceType = item.ResourceType,
+                        LabelNameDescribe = item.LabelNameDescribe,
+                        Remark = item.Remark
+                    };
+                    // 特殊 130,示范课堂140,品牌专区1(150),品牌专区2(160)
+                    var specialInts = systemLabels.Where(n => n.ResourceType >= 130).Select(n => n.ResourceType);
+                    if (specialInts.Contains(item.ResourceType))
+                    {
+                        //获取特殊
+                        navigationLabelMediaResult.IsSpecial = true;
+                        navigationLabelMediaResult.SpecialLabelResults = await specialLabelRepository.GetAllAsync(item.ResourceType);
+                        foreach (var specialLabelResult in navigationLabelMediaResult.SpecialLabelResults)
+                            specialLabelResult.ImageUrls = StringUtils.AddDomain(specialLabelResult.ImageUrls);
+                        result.NavigationLabelMediaResults.Add(navigationLabelMediaResult);
+                        continue;
+                    }
+                    //获取媒体标签
+                    var lableInts = new List<int> { item.Id };
+                    var medias = await _mediaRepository.GetNavigationMediaResults(lableInts);
+                    navigationLabelMediaResult.MediaResults = medias.ToList();
+                    foreach (var itemMedia in navigationLabelMediaResult.MediaResults)
+                        itemMedia.ImageUrls = StringUtils.AddDomain(itemMedia.ImageUrls);
+                    result.NavigationLabelMediaResults.Add(navigationLabelMediaResult);
+                }
+            }
+            return result;
+        }
+    }
+}

+ 14 - 0
gx_api/GxPress/Service/GxPress.Service.Interface/Navigation/INavigationService.cs

@@ -0,0 +1,14 @@
+using System.Threading.Tasks;
+using GxPress.Result.Navigation;
+
+namespace GxPress.Service.Interface.Navigation
+{
+    public interface INavigationService:IService
+    {
+           /// <summary>
+        /// 获取导航栏数据
+        /// </summary>
+        /// <returns></returns>
+       Task<MiddleLableResult> GetNavigationResults(int navigationId);
+    }
+}