コード例 #1
0
        /// <summary>
        /// 获取在线用户消息分页
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public UserOnLineInfo GetOnlineListByPage(string userId, int pageIndex, int pageSize)
        {
            var online = new UserOnLineInfo();

            try
            {
                var user = _chatHelper.GetUserInfo(userId);
                var list = new List <UserOnlineModel>();
                if (!string.IsNullOrEmpty(userId))
                {
                    online.MessageList = _crmEvaMstrRepository.GetUserOnlineListByPage(user.USR_TYPE, user.ORG_NO, user.BG_NO, pageIndex, pageSize).Data;
                    if (online.MessageList.Count > 0)
                    {
                        foreach (var item in online.MessageList)
                        {
                            var model = UserList.Where(c => c.UserId == item.OPEN_ID).FirstOrDefault();
                            item.ONLINESTATUS = model != null ? true : false;
                        }
                        online.totalCount = online.MessageList.Select(c => c.UNREADCOUNT).ToList().Sum();
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(online);
        }