李昊 4 years ago
parent
commit
a38a468204

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

@@ -131,7 +131,7 @@ namespace GxPress.Api.AppControllers
         /// </summary>
         /// <returns></returns>
         [HttpPost("day-skill")]
-         [AllowAnonymous]
+        [AllowAnonymous]
         public async Task<PagedList<MediaCathedraResult>> GetDaySkillsAsync(Common.Page.PageParameter request)
         {
             return await mediaRepository.GetDaySkillsAsync(request);
@@ -142,10 +142,23 @@ namespace GxPress.Api.AppControllers
         /// </summary>
         /// <returns></returns>
         [HttpGet("random-day-skill")]
-         [AllowAnonymous]
+        [AllowAnonymous]
         public async Task<SkillInfo> GetRandomDaySkillAsync()
         {
             return await mediaRepository.GetRandomDaySkillAsync();
         }
+        /// <summary>
+        /// 书城
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet("book-city")]
+        [AllowAnonymous]
+        public async Task<List<AppLabelResult<MediaCathedraResult>>> GetBookCityAsync()
+        {
+            ArticleGroupRequest request = new ArticleGroupRequest();
+            request.ActionUrl = "api/app/page/lable";
+            return await appHomePageService.GetBookCityAsync(request);
+        }
+
     }
 }

+ 2 - 2
gx_api/GxPress/Model/GxPress.Request/User/UserRequest.cs

@@ -82,7 +82,7 @@ namespace GxPress.Request.User
         /// 是否是领导
         /// </summary>
 
-        public bool IsLeader { get; set; }
+        public int IsLeader { get; set; }
 
         /// <summary>
         /// 入职时间
@@ -113,7 +113,7 @@ namespace GxPress.Request.User
         /// 是否静音
         /// </summary>
 
-        public bool IsMute { get; set; }
+        public int IsMute { get; set; }
         /// <summary>
         /// 是否震动
         /// </summary>

+ 4 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/Navigation/MiddleLableRepository.cs

@@ -35,6 +35,10 @@ namespace GxPress.Repository.Implement.Navigation
         {
             return await _repository.GetAsync(id);
         }
+        public async Task<Entity.Navigations.MiddleLable> GetAsync(string name)
+        {
+            return await _repository.GetAsync(Q.Where(nameof(Entity.Navigations.MiddleLable.Name), name));
+        }
 
         public async Task<bool> DeleteAsync(int id)
         {

+ 5 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/UserRepository.cs

@@ -412,6 +412,10 @@ namespace GxPress.Repository.Implement
                 user.IsFreeze = request.IsFreeze == 1;
             if (request.IsVip > 0)
                 user.IsVip = request.IsVip == 1;
+            if (request.IsLeader > 0)
+                user.IsLeader = request.IsLeader == 1;
+            if (request.IsMute > 0)
+                user.IsMute = request.IsMute == 1;
             if (!string.IsNullOrWhiteSpace(request.DisableTiem))
                 user.DisableTiem = Convert.ToDateTime(request.DisableTiem);
             return await UpdateAsync(user);
@@ -935,7 +939,7 @@ namespace GxPress.Repository.Implement
             if (request.RenewalCount > 0)
                 query.Where(nameof(User.RenewalCount), request.RenewalCount);
             result.Total = await _repository.CountAsync(query);
-            if (!string.IsNullOrEmpty(request.Sort)&&request.Sort.Equals("AccumulativePrice"))
+            if (!string.IsNullOrEmpty(request.Sort) && request.Sort.Equals("AccumulativePrice"))
                 query.OrderByDesc(nameof(User.AccumulativePrice));
             else
                 query.OrderByDesc(nameof(User.CreatedDate));

+ 1 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/Navigation/IMiddleLableRepository.cs

@@ -8,6 +8,7 @@ namespace GxPress.Repository.Interface.Navigation
     public interface IMiddleLableRepository : IRepository
     {
         Task<Entity.Navigations.MiddleLable> GetAsync(int id);
+        Task<Entity.Navigations.MiddleLable> GetAsync(string name);
         Task<bool> DeleteAsync(int id);
 
         Task<int> InsertAsync(Entity.Navigations.MiddleLable note);

+ 41 - 0
gx_api/GxPress/Service/GxPress.Service.Implement/AppHomePage/AppHomePageService.cs

@@ -220,5 +220,46 @@ namespace GxPress.Service.Implement.AppHomePage
             var teachers = await teacherRepository.GetTeacherResult(request);
             return teachers;
         }
+        /// <summary>
+        /// 书城
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        public async Task<List<AppLabelResult<MediaCathedraResult>>> GetBookCityAsync(ArticleGroupRequest request)
+        {
+            var result = new List<AppLabelResult<MediaCathedraResult>>();
+            //获取中间页面
+            var middleLable = await _middleLableRepository.GetAsync("书城");
+            //获取中间页标签
+            var middleLableNexusIds = await middleLableNexusRepository.GetAllTaskAsync(middleLable.Id);
+            //获取标签
+            var systemLabels = await _systemLabelRepository.GetAllAsync(middleLableNexusIds.Select(n => n.LableId).ToList());
+            foreach (var item in systemLabels)
+            {
+                //获取媒体标签
+                var mediaIds = await _mediaLableRepository.GetMediaIdsAysnc(item.Id);
+                var medias = await mediaRepository.GetNavigationMediaResults(mediaIds, item.PageSize);
+                var list = new List<MediaCathedraResult>();
+                foreach (var mediaModel in medias)
+                {
+                    list.Add(new MediaCathedraResult { Id = mediaModel.Id, Title = mediaModel.Title, ImageUrls = StringUtils.AddDomain(mediaModel.ImageUrls), Author = mediaModel.Author, ReadCount = mediaModel.ReadCount, CreatedDate = mediaModel.CreatedDate, CollectCount = mediaModel.CollectCount, MediaType = mediaModel.MediaType });
+                }
+                //获取常规数据
+                var mediaCathedraResult = new AppLabelResult<MediaCathedraResult>()
+                {
+                    IsPage = item.IsPage,
+                    Id = item.Id,
+                    LabelName = item.LabelName,
+                    ResourceType = 40,
+                    Items = list,
+                    Method = item.IsPage ? "post" : "",
+                    ActionUrl = item.IsPage ? request.ActionUrl : ""
+                };
+                result.Add(mediaCathedraResult);
+            }
+
+            return result;
+        }
+
     }
 }

+ 6 - 0
gx_api/GxPress/Service/GxPress.Service.Interface/AppHomePage/IAppHomePageService.cs

@@ -44,5 +44,11 @@ namespace GxPress.Service.Interface.AppHomePage
         /// </summary>
         /// <returns></returns>
         Task<PagedList<MediaCathedraResult>> GetMediaByLableIdAsync(MediaLableIdRequest request);
+         /// <summary>
+        /// 书城
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+         Task<List<AppLabelResult<MediaCathedraResult>>> GetBookCityAsync(ArticleGroupRequest request);
     }
 }