李昊 4 years ago
parent
commit
d030dd8e84
1 changed files with 141 additions and 0 deletions
  1. 141 0
      gx_api/GxPress/Api/GxPress.Api/WebControllers/WebGroupController.cs

+ 141 - 0
gx_api/GxPress/Api/GxPress.Api/WebControllers/WebGroupController.cs

@@ -1,11 +1,15 @@
 using System.Collections.Generic;
 using System.Threading.Tasks;
 using GxPress.Auth;
+using GxPress.Common.Page;
 using GxPress.Repository.Interface;
 using GxPress.Repository.Interface.Group;
 using GxPress.Request.App.Group;
 using GxPress.Request.App.GroupUser;
+using GxPress.Request.App.Topic;
 using GxPress.Result.App.Group;
+using GxPress.Result.App.GroupUser;
+using GxPress.Result.App.Topic;
 using GxPress.Result.Web;
 using GxPress.Service.Interface.Group;
 using GxPress.Service.Interface.Topic;
@@ -87,5 +91,142 @@ namespace GxPress.Api.WebControllers
         {
             return await groupCategroyRepository.GetAllAsync(parentId);
         }
+
+         /// <summary>
+        /// 删除小组成员
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("delete-user")]
+        public async Task<bool> DeleteGroupUser(GroupUserDeRequest request)
+        {
+            return await _groupService.DeleteAsync(request);
+        }
+
+        /// <summary>
+        /// 退出小组
+        /// </summary>
+        /// <param name="groupId"></param>
+        /// <returns></returns>
+        [HttpDelete("{groupId}")]
+        public async Task<bool> DeleteAsync(int groupId)
+        {
+            return await _groupService.DeleteAsync(_loginContext.AccountId, groupId);
+        }
+
+        /// <summary>
+        /// 根据文件夹ID查询小组列表
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("find")]
+        public async Task<PagedList<GroupUserFindResult>> FindGroupByGroupFolderId(GroupSearchRequest request)
+        {
+            request.UserId = _loginContext.AccountId;
+            return await _groupService.FindGroupByGroupFolderIdAsync(request);
+        }
+
+        /// <summary>
+        /// 获取小组详情
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("detail")]
+        public async Task<GroupDetailResult> GroupDetailAsync(GroupDetailRequest request)
+        {
+            request.UserId = _loginContext.AccountId;
+            return await _groupService.GroupDetailAsync(request);
+        }
+
+        /// <summary>
+        /// 修改小组
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("update")]
+        public async Task<bool> Update(GroupUpRequest request)
+        {
+            return await _groupRepository.UpdateAsync(request);
+        }
+
+        /// <summary>
+        ///设置权限
+        /// 1 超级管理员 2 管理员 3普通用户
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("update-user")]
+        public async Task<bool> UpdateGroupUser(GroupUserUpRequest request)
+        {
+            return await _groupUserRepository.UpdateAsync(request);
+        }
+
+        /// <summary>
+        /// 根据GroupId获取话题列表
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("search")]
+        public async Task<PagedList<TopicListPageResult>> FindTopicByGroupId(TopicDetailListRequest request)
+        {
+            request.UserId = _loginContext.AccountId;
+            return await _topicService.FindTopicByGroupIdAsync(request);
+        }
+
+        /// <summary>
+        /// 加入是否管理员同意
+        /// </summary>
+        /// <param name="groupId"></param>
+        /// <returns></returns>
+        [HttpPut("set-admin/{groupId}")]
+        public async Task<bool> SetGroupIsAdmin(int groupId)
+        {
+            return await _groupRepository.SetGroupIsAdminAsync(groupId);
+        }
+        /// <summary>
+        /// 是否禁言
+        /// </summary>
+        /// <param name="groupId"></param>
+        /// <returns></returns>
+        [HttpPut("set-words/{groupId}")]
+        public async Task<bool> SetGroupIsWords(int groupId)
+        {
+            return await _groupRepository.SetGroupIsWordsAsync(groupId);
+        }
+
+        /// <summary>
+        /// 扫描二维码获取小组详情
+        /// </summary>
+        /// <param name="guId"></param>
+        /// <returns></returns>
+        [HttpGet("{guId}")]
+        public async Task<GroupDetailResult> GroupDetailByGuId(string guId)
+        {
+            var userId = _loginContext.AccountId;
+            return await _groupService.GroupDetailByGuIdAsync(guId, userId);
+        }
+
+        /// <summary>
+        /// 设置用户是否免打扰
+        /// </summary>
+        /// <param name="groupId"></param>
+        /// <returns></returns>
+        [HttpPut("set-disturb/{groupId}")]
+        public async Task<bool> SetIsUDisturbAsync(int groupId)
+        {
+            var userId = _loginContext.AccountId;
+            return await _groupUserRepository.SetIsUDisturbAsync(groupId, userId);
+        }
+
+        /// <summary>
+        /// 搜索小组成员
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("search-group-user")]
+        public async Task<IEnumerable<GroupUserListResult>> SearchGroupUserAsync(TopicDetailListRequest request)
+        {
+            return await _groupRepository.SearchGroupUserAsync(request);
+        }
     }
 }