Esempio n. 1
0
        public JsonResult HandleApply(int applyid, int userid, short result, string reason = "")
        {
            var res = LayIMUserJoinBLL.Instance.HandleApply(applyid, userid, result, reason);
            var msg = res.data as ApplyHandledMessgae;

            //推送消息
            HubServerHelper.SendMessage(msg);
            return(Json(res, JsonRequestBehavior.DenyGet));
        }
Esempio n. 2
0
        public JsonResult CreateGroup(string n, string d, int uid)
        {
            var result = LayimUserBLL.Instance.CreateGroup(n, d, uid);
            var group  = result.data as UserGroupCreatedMessage;

            //向客户端推送创建成功的消息
            HubServerHelper.SendMessage(group, uid.ToString(), ChatToClientType.GroupCreatedToClient);
            return(Json(result, JsonRequestBehavior.DenyGet));
        }
Esempio n. 3
0
        public JsonResult AddFriendOrJoinInGroup(int userid, int targetid, string other = "", bool isfriend = true)
        {
            if (userid == targetid)
            {
                throw new ArgumentException("userid can't equal with targetid");
            }
            var result = LayIMUserJoinBLL.Instance.AddApply(userid, targetid, other, isfriend);

            string[] toUserIds = result.data as string[];
            if (toUserIds.Length > 0)
            {
                string userIdsStr = string.Join(",", toUserIds);
                //给对方发送好友消息 传targetid
                HubServerHelper.SendMessage(new ApplySendedMessage {
                    msg = isfriend ? "您有1条加好友消息" : "您有1条加群消息"
                }, userIdsStr, ChatToClientType.ApplySendedToClient, !isfriend);
            }
            return(Json(result, JsonRequestBehavior.DenyGet));
        }