李昊 %!s(int64=4) %!d(string=hai) anos
pai
achega
2ad1633fc7

+ 10 - 1
gx_api/GxPress/Api/GxPress.Api/WebControllers/WebGroupController.cs

@@ -229,6 +229,15 @@ namespace GxPress.Api.WebControllers
         {
             return await _groupRepository.SearchGroupUserAsync(request);
         }
-
+        /// <summary>
+        /// 根据parendId获取小组广场
+        /// </summary>
+        /// <param name="parentId"></param>
+        /// <returns></returns>
+        [HttpGet("list-group-categroy/{parentId}")]
+        public async Task<IEnumerable<GroupCategoryResult>> GetAllByGroupCategroyAsync(int parentId)
+        {
+            return await groupCategroyRepository.GetAllAsync(parentId);
+        }
     }
 }

+ 207 - 0
gx_api/GxPress/Api/GxPress.Api/WebControllers/WebMiddleController.cs

@@ -0,0 +1,207 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using GxPress.Auth;
+using GxPress.Repository.Interface;
+using GxPress.Request.App.Middle;
+using GxPress.Request.Notice;
+using GxPress.Request.NoticeFolder;
+using GxPress.Result.App.Middle;
+using GxPress.Service.Interface.Middle;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+namespace GxPress.Api.WebControllers
+{
+    /// <summary>
+    /// 中间件
+    /// </summary>
+    [Route("api/web/middle")]
+    [ApiController]
+    [Authorize]
+
+    public class WebMiddleController : Controller
+    {
+        public readonly IMiddleService _middleService;
+        public readonly ILoginContext _loginContext;
+        private readonly IFolderUserRepository _folderUserRepository;
+
+        public WebMiddleController(IMiddleService middleService, ILoginContext loginContext,
+            IFolderUserRepository folderUserRepository)
+        {
+            _middleService = middleService;
+            _loginContext = loginContext;
+            _folderUserRepository = folderUserRepository;
+        }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("sort")]
+        public async Task<bool> MiddleSort(MiddleSortRequest request)
+        {
+            return await _middleService.MiddleSortAsync(request);
+        }
+        /// <summary>
+        /// 创建文件夹
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPut("add-folder")]
+        public async Task<bool> Insert(NoticeFolderInRequest request)
+        {
+            request.UserId = _loginContext.AccountId;
+            var middleInsertRequest = new MiddleInsertRequest
+            {
+                FolderName = request.FolderName,
+                FolderType = request.TypeId,
+                ParentId = request.ParentId,
+                UserId = request.UserId,
+                RoleId = request.RoleId,
+                UserIds = request.UserIds,
+                UserMiddles = request.UserMiddles
+            };
+            return await _middleService.InsertAsync(middleInsertRequest) > 0;
+
+        }
+        /// <summary>
+        /// 设置置顶
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpPut("{id}")]
+        public async Task<bool> SetTop(int id)
+        {
+            return await _middleService.SetTopAsync(id);
+        }
+
+        /// <summary>
+        /// 删除记录
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("delete")]
+        public async Task<bool> Delete(NoticeDeRequest request)
+        {
+            var userId = _loginContext.AccountId;
+            request.UserId = userId;
+            return await _middleService.DeleteAsync(request);
+        }
+
+        /// <summary>
+        /// 恢复删除
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("recover-delete")]
+        public async Task<bool> RecoverDelete(NoticeDeRequest request)
+        {
+            return await _middleService.RecoverDeleteAsync(request);
+        }
+        /// <summary>
+        /// 恢复全部
+        /// </summary>
+        /// <param name="folderType">文件夹类型 1 通知 2话题 3 收藏 4笔记 5 普通站内信 6匿名站内信 7小组</param>
+        /// <returns></returns>
+        [HttpPut("recover-all/{folderType}")]
+        public async Task<bool> RecoverAllAsync(int folderType)
+        {
+            return await _middleService.RecoverAllAsync(folderType, _loginContext.AccountId);
+        }
+        /// <summary>
+        /// 删除全部
+        /// </summary>
+        /// <param name="folderType">文件夹类型 1 通知 2话题 3 收藏 4笔记 5 普通站内信 6匿名站内信 7小组</param>
+        /// <returns></returns>
+        [HttpDelete("delete-all/{folderType}")]
+        public async Task<bool> DeleteAllAsync(int folderType)
+        {
+            return await _middleService.DeleteAllAsync(folderType, _loginContext.AccountId);
+        }
+        /// <summary>
+        /// 移动
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("move")]
+        public async Task<bool> SetMove(MiddleMoveRequest request)
+        {
+            return await _middleService.SetMove(request);
+        }
+
+        /// <summary>
+        /// 修改文件夹名称
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("update")]
+        public async Task<bool> UpdateFolderName(MiddleFolderNameRequest request)
+        {
+            return await _middleService.UpdateFolderNameAsync(request);
+        }
+
+        /// <summary>
+        /// 查询文件夹
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("search-folder")]
+        public async Task<List<MiddleSearchFolderResult>> SearchFolderAsync(MiddleSearchFolderRequest request)
+        {
+            request.UserId = _loginContext.AccountId;
+            return await _middleService.SearchFolderAsync(request);
+        }
+
+        /// <summary>
+        /// 获取话题 笔记共享范围文件夹
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("search-note-folder")]
+        public async Task<List<MiddleSearchFolderResult>> SearchNoteFolderAsync(MiddleSearchFolderRequest request)
+        {
+            request.UserId = _loginContext.AccountId;
+            return await _middleService.SearchNoteFolderAsync(request);
+        }
+        /// <summary>
+        /// 修改文件夹名称或权限
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPut("update-role")]
+        public async Task<bool> UpdateFolderRole(MiddleUpdateFolderRoleRequest request)
+        {
+            return await _middleService.UpdateFolderRoleAsync(request);
+        }
+        /// <summary>
+        /// 根据文件夹ID查询文件夹信息
+        /// </summary>
+        /// <param name="middleId"></param>
+        /// <returns></returns>
+        [HttpGet("find-folder-info/{middleId}")]
+        public async Task<MiddleFolderInfoResult> GetFolderUser(int middleId)
+        {
+            return await _middleService.GetFolderInfo(middleId);
+        }
+        /// <summary>
+        /// 根据文件夹ID查询文件夹信息
+        /// </summary>
+        /// <param name="middleId"></param>
+        /// <returns></returns>
+        [HttpGet("web-folder-info/{middleId}")]
+        [AllowAnonymous]
+        public async Task<MiddleFolderInfoResult> GetFolderInfo(int middleId)
+        {
+            return await _middleService.GetFolderInfo(middleId);
+        }
+        /// <summary>
+        /// 获取默认的共享文件夹范围
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet("enjoy-default/{folderType}")]
+        public async Task<MiddleDefaultResult> GetEnjoyDefault(int folderType)
+        {
+            return await _middleService.GetEnjoyDefaultAsync(_loginContext.AccountId, folderType);
+        }
+    }
+}