示例#1
0
        public ActionResult SendMsg(string userId, string content)
        {
            UserInfo    userInfo = LoginUserInfo.Get();
            IMMsgEntity entity   = new IMMsgEntity();

            entity.F_SendUserId = userInfo.userId;
            entity.F_RecvUserId = userId;
            entity.F_Content    = content;
            iMMsgIBLL.SaveEntity(entity);
            return(Success("保存成功!"));
        }
示例#2
0
文件: IMApi.cs 项目: scsi110/Learun7
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="_"></param>
        /// <returns></returns>
        public Response SendMsg(dynamic _)
        {
            MsgModel    msyModel = this.GetReqData <MsgModel>();// 获取模板请求数据
            IMMsgEntity entity   = new IMMsgEntity();

            entity.F_SendUserId = userInfo.userId;
            entity.F_RecvUserId = msyModel.userId;
            entity.F_Content    = msyModel.content;
            iMMsgIBLL.SaveEntity(entity);
            // 向即时消息服务器发送一条信息
            SendHubs.callMethod("sendMsg2", userInfo.userId, msyModel.userId, msyModel.content, 0);

            var jsonData = new
            {
                time  = entity.F_CreateDate,
                msgId = entity.F_MsgId
            };

            return(Success(jsonData));
        }