李昊 4 anos atrás
pai
commit
bbf373f37f

+ 14 - 0
gx_api/GxPress/Model/GxPress.EnumConst/SpecialConst.cs

@@ -0,0 +1,14 @@
+namespace GxPress.EnumConst
+{
+    /// <summary>
+    /// 特殊榜单 130 示范课堂 140  品牌专区1 150 品牌专区2 160 直播 170 名师 180
+    /// </summary>
+    public enum SpecialConst
+    {
+        classroom = 140,
+        brand = 150,
+        brandPlus = 160,
+        live = 170,
+        Teacher = 180
+    }
+}

+ 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 ,榜单 130 示范课堂 140  品牌专区1 150 品牌专区2 160
+    /// 资源类型 文章100书籍20,课程30,音频40,期刊50,视频60,名栏90,公众号110,刊期120 
     /// </summary>
     public enum ResourceTypeConst
     {

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

@@ -1,5 +1,6 @@
 using System.Collections.Generic;
 using GxPress.Result.Media;
+using GxPress.Result.Teacher;
 
 namespace GxPress.Result.Navigation
 {
@@ -90,6 +91,11 @@ namespace GxPress.Result.Navigation
         /// <value></value>
         public IEnumerable<Entity.SystemLabel.SpecialLabel> SpecialLabelResults { get; set; }
         /// <summary>
+        /// 名师
+        /// </summary>
+        /// <value></value>
+        public IEnumerable<TeacherResult> TeacherResults { get; set; }
+        /// <summary>
         /// 是否特殊
         /// </summary>
         /// <value></value>
@@ -99,6 +105,11 @@ namespace GxPress.Result.Navigation
         /// </summary>
         /// <value></value>
         public bool IsShowLabelName { get; set; }
+        /// <summary>
+        /// 是否老师
+        /// </summary>
+        /// <value></value>
+        public bool IsTeacher { get; set; }
     }
     /// <summary>
     /// 中间页面

+ 36 - 0
gx_api/GxPress/Model/GxPress.Result/Teacher/TeacherResult.cs

@@ -0,0 +1,36 @@
+namespace GxPress.Result.Teacher
+{
+    /// <summary>
+    /// 老师
+    /// </summary>
+    public class TeacherResult
+    {
+        /// <summary>
+        /// ID
+        /// </summary>
+        /// <value></value>
+        public int Id { get; set; }
+        /// <summary>
+        /// 名称
+        /// </summary>
+        /// <value></value>
+
+
+        public string Name { get; set; }
+
+
+        /// <summary>
+        /// 简介
+        /// </summary>
+        /// <value></value>
+
+
+        public string Summary { get; set; }
+
+        /// <summary>
+        /// 图片
+        /// </summary>
+
+        public string ImageUrl { get; set; }
+    }
+}

+ 17 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/Teacher/TeacherRepository.cs

@@ -7,6 +7,7 @@ using GxPress.Common.Page;
 using GxPress.Common.Tools;
 using GxPress.Repository.Interface.Teacher;
 using GxPress.Request.TeacherRequest;
+using GxPress.Result.Teacher;
 using Microsoft.Extensions.Options;
 using SqlKata;
 
@@ -75,5 +76,21 @@ namespace GxPress.Repository.Implement.Teacher
         {
             return await _repository.UpdateAsync(query) > 0;
         }
+
+        public async Task<IEnumerable<TeacherResult>> GetTeacherResult()
+        {
+            var query = Q.NewQuery();
+            query.Select(nameof(Entity.tede2.Teacher.Teacher.Id));
+            query.Select(nameof(Entity.tede2.Teacher.Teacher.Name));
+            query.Select(nameof(Entity.tede2.Teacher.Teacher.Summary));
+            query.Select(nameof(Entity.tede2.Teacher.Teacher.ImageUrl));
+            query.OrderByDesc(nameof(Entity.tede2.Teacher.Teacher.Sort));
+            var result = await _repository.GetAllAsync<TeacherResult>(query);
+            foreach (var item in result)
+            {
+                item.ImageUrl = StringUtils.AddDomain(item.ImageUrl);
+            }
+            return result;
+        }
     }
 }

+ 3 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/Teacher/ITeacherRepository.cs

@@ -3,6 +3,7 @@ using System.Threading.Tasks;
 using Datory;
 using GxPress.Common.Page;
 using GxPress.Request.TeacherRequest;
+using GxPress.Result.Teacher;
 
 namespace GxPress.Repository.Interface.Teacher
 {
@@ -16,5 +17,7 @@ namespace GxPress.Repository.Interface.Teacher
 
         Task<bool> UpdateAsync(Entity.tede2.Teacher.Teacher note);
         Task<IEnumerable<Entity.tede2.Teacher.Teacher>> GetSearchAllAsync(TeacherRequest request);
+
+        Task<IEnumerable<TeacherResult>> GetTeacherResult();
     }
 }

+ 14 - 2
gx_api/GxPress/Service/GxPress.Service.Implement/Navigation/NavigationService.cs

@@ -3,11 +3,13 @@ using System.Linq;
 using System.Threading.Tasks;
 using AutoMapper;
 using GxPress.Common.Tools;
+using GxPress.EnumConst;
 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.Repository.Interface.Teacher;
 using GxPress.Result.Navigation;
 using GxPress.Service.Interface.Navigation;
 
@@ -23,8 +25,9 @@ namespace GxPress.Service.Implement.Navigation
         private readonly IMediaLableRepository _mediaLableRepository;
         private readonly ISlideRepository slideRepository;
         private readonly ISpecialLabelRepository specialLabelRepository;
+        private readonly ITeacherRepository teacherRepository;
 
-        public NavigationService(INavigationRepository _repository, IMapper _mapper, IMiddleLableRepository _middleLableRepository, ISystemLabelRepository _systemLabelRepository, IMediaRepository _mediaRepository, IMediaLableRepository _mediaLableRepository, ISlideRepository slideRepository, ISpecialLabelRepository specialLabelRepository)
+        public NavigationService(INavigationRepository _repository, IMapper _mapper, IMiddleLableRepository _middleLableRepository, ISystemLabelRepository _systemLabelRepository, IMediaRepository _mediaRepository, IMediaLableRepository _mediaLableRepository, ISlideRepository slideRepository, ISpecialLabelRepository specialLabelRepository, ITeacherRepository teacherRepository)
         {
             this._navigationrepository = _repository;
             this._middleLableRepository = _middleLableRepository;
@@ -34,6 +37,7 @@ namespace GxPress.Service.Implement.Navigation
             this.slideRepository = slideRepository;
             this._mapper = _mapper;
             this.specialLabelRepository = specialLabelRepository;
+            this.teacherRepository = teacherRepository;
         }
         /// <summary>
         /// 获取导航栏数据
@@ -81,12 +85,20 @@ namespace GxPress.Service.Implement.Navigation
                         Remark = item.Remark,
                         IsShowLabelName = item.IsShowLabelName
                     };
-                    // 特殊 130,示范课堂140,品牌专区1(150),品牌专区2(160)
+                    // 特殊 130,示范课堂140,品牌专区1(150),品牌专区2(160),170 直播 180 名师
                     var specialInts = systemLabels.Where(n => n.ResourceType >= 130).Select(n => n.ResourceType);
                     if (specialInts.Contains(item.ResourceType))
                     {
                         //获取特殊
                         navigationLabelMediaResult.IsSpecial = true;
+                        //名师
+                        if (item.ResourceType == SpecialConst.Teacher.GetHashCode())
+                        {
+                            navigationLabelMediaResult.IsTeacher = true;
+                            navigationLabelMediaResult.TeacherResults = await teacherRepository.GetTeacherResult();
+                            result.NavigationLabelMediaResults.Add(navigationLabelMediaResult);
+                            continue;
+                        }
                         navigationLabelMediaResult.SpecialLabelResults = await specialLabelRepository.GetAllAsync(item.ResourceType);
                         foreach (var specialLabelResult in navigationLabelMediaResult.SpecialLabelResults)
                             specialLabelResult.ImageUrls = StringUtils.AddDomain(specialLabelResult.ImageUrls);