/// <summary> /// 接受/拒绝群组加入申请 /// </summary> /// <param name="groupIds">申请Id列表</param> /// <param name="isApproved">是否接受</param> public void ApproveGroupMemberApply(IEnumerable <long> applyIds, bool isApproved) { //设计要点: //1、仅允许对待处理状态的申请变更状态; //2、通过批准的申请,直接创建GroupMember IEnumerable <GroupMemberApply> groupMemberApplies = groupMemberApplyRepository.PopulateEntitiesByEntityIds(applyIds); GroupMemberApplyStatus applyStatus = isApproved ? GroupMemberApplyStatus.Approved : GroupMemberApplyStatus.Disapproved; string operationType = isApproved ? EventOperationType.Instance().Approved() : EventOperationType.Instance().Disapproved(); foreach (var apply in groupMemberApplies) { if (apply.ApplyStatus != GroupMemberApplyStatus.Pending) { continue; } apply.ApplyStatus = applyStatus; groupMemberApplyRepository.Update(apply); EventBus <GroupMemberApply> .Instance().OnAfter(apply, new CommonEventArgs(operationType)); if (isApproved) { GroupMember member = GroupMember.New(); member.UserId = apply.UserId; member.GroupId = apply.GroupId; CreateGroupMember(member); } } }
/// <summary> /// 获取群组的加入申请列表 /// </summary> /// <param name="groupId">群组Id</param> /// <param name="applyStatus">申请状态</param> /// <param name="pageSize">每页记录数</param> /// <param name="pageIndex">页码</param> /// <returns>加入申请分页数据</returns> public PagingDataSet<GroupMemberApply> GetGroupMemberApplies(long groupId, GroupMemberApplyStatus? applyStatus, int pageSize = 20, int pageIndex = 1) { //设计要点: //1、排序:申请状态正序、申请时间倒序(Id代替); return groupMemberApplyRepository.GetGroupMemberApplies(groupId, applyStatus, pageSize, pageIndex); }
/// <summary> /// 申请处理 /// </summary> /// <param name="siteUrls"></param> /// <param name="spaceKey"></param> /// <param name="groupId"></param> /// <param name="applyStatus"></param> /// <returns></returns> public static string ManageMemberApplies(this SiteUrls siteUrls, string spaceKey, GroupMemberApplyStatus? applyStatus = null) { RouteValueDictionary route = new RouteValueDictionary(); route.Add("spaceKey", spaceKey); if (applyStatus != null) route.Add("applyStatus", applyStatus); return CachedUrlHelper.Action("ManageMemberApplies", "GroupSpaceSettings", GroupAreaName, route); }
public ActionResult ManageMemberApplies(string spaceKey, GroupMemberApplyStatus? applyStatus, int pageIndex = 1, int pageSize = 20) { GroupEntity group = groupService.Get(spaceKey); if (group == null) return HttpNotFound(); pageResourceManager.InsertTitlePart(group.GroupName); pageResourceManager.InsertTitlePart("管理群组成员申请页"); //已修改 PagingDataSet<GroupMemberApply> groupMemberApplies = groupService.GetGroupMemberApplies(group.GroupId, applyStatus, pageSize, pageIndex); ViewData["groupId"] = group.GroupId; TempData["GroupMenu"] = GroupMenu.ManageMember; return View(groupMemberApplies); }