예제 #1
0
        /// <summary>会员进入群组</summary>
        public ChatResult EnterGroup(int groupId)
        {
            if (!_chatBLL.CanEnterGroup(groupId))
            {
                return(ChatResult.FailResult);
            }

            // 会员信息列表
            var users  = _chatBLL.GetUsersInfoFromGroup(groupId);
            var userId = _userInfo.UserId;

            // 推送个人信息
            var user = users.FirstOrDefault(p => p.UserId == userId);

            SendToGroup(groupId, ChatNotifyType.EnterGroup, null, user);

            // 聊天历史
            var msgs = _chatBLL.GetChatMsg(groupId);

            return(ChatResult.Success(new
            {
                users,
                msgs
            }));
        }
예제 #2
0
        /// <summary>获取所有群组</summary>
        public ChatResult GetGroups()
        {
            var groups = _chatBLL.GetGroupsFromUserId(_userInfo.UserId);

            return(ChatResult.Success(groups));
        }
예제 #3
0
        /// <summary>新建群组</summary>
        public ChatResult CreateGroup(string groupName)
        {
            var groupId = _chatBLL.CreateGroup(groupName);

            return(ChatResult.Success(new { groupId }));
        }