lihao 4 years ago
parent
commit
235e4b7498

+ 11 - 0
gx_api/GxPress/Api/GxPress.Api/AppControllers/MiddleController.cs

@@ -221,5 +221,16 @@ namespace GxPress.Api.AppControllers
         {
             return await _middleService.GetLatelyNoteFolderAsync(_loginContext.AccountId);
         }
+        // /// <summary>
+        // /// 根据类型搜索文件夹
+        // /// </summary>
+        // /// <param name="request"></param>
+        // /// <returns></returns>
+        // [HttpPost("search-folder")]
+        // public async Task<IEnumerable<Entity.Middle.Middle>> GetSearchFolderResult(MiddleSearchFolderRequest request)
+        // {
+        //     request.UserId = _loginContext.AccountId;
+        //     return await _middleService.GetSearchFolderResult(request);
+        // }
     }
 }

+ 1 - 0
gx_api/GxPress/Api/GxPress.Api/WebControllers/ArticleController.cs

@@ -103,6 +103,7 @@ namespace GxPress.Api.AppControllers
         /// </summary>
         /// <returns></returns>
         [HttpGet("detail/{id}")]
+        [AllowAnonymous]
         public async Task<ArticleResult> Get(int id)
         {
             var article = await _articleService.GetAsync(id, _loginContext.AccountId);

+ 15 - 0
gx_api/GxPress/Service/GxPress.Service.Implement/Middle/MiddleService.cs

@@ -821,6 +821,21 @@ namespace GxPress.Service.Implement.Middle
             return result;
         }
         /// <summary>
+        /// 根据类型搜索文件夹
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        public async Task<IEnumerable<Entity.Middle.Middle>> GetSearchFolderResult(MiddleSearchFolderRequest request)
+        {
+            var query = Q.NewQuery();
+            query.Where(nameof(Entity.Middle.Middle.FolderType), request.TypeId);
+            query.Where(query.WhereLike(nameof(Entity.Middle.Middle.FolderName), $"%{request.KeyWord}%"));
+            query.Where(nameof(Entity.Middle.Middle.UserId), request.UserId);
+            query.OrderByDesc(nameof(Entity.Middle.Middle.IsTop), nameof(Entity.Middle.Middle.LastModifiedDate));
+            return await _middleRepository.GetAllAsync(query);
+
+        }
+        /// <summary>
         /// 获取话题 笔记共享范围文件夹
         /// </summary>
         /// <param name="request"></param>

+ 7 - 0
gx_api/GxPress/Service/GxPress.Service.Interface/Middle/IMiddleService.cs

@@ -120,6 +120,13 @@ namespace GxPress.Service.Interface.Middle
         /// <param name="request"></param>
         /// <returns></returns>
         Task<List<MiddleSearchFolderResult>> GetLatelyTopicFolderAsync(int userId);
+
+        /// <summary>
+        /// 根据类型搜索文件夹
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        Task<IEnumerable<Entity.Middle.Middle>> GetSearchFolderResult(MiddleSearchFolderRequest request);
       
     }
 }