/// <summary>
        /// 添加聊天消息记录
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public override bool AddChatMsg(LayimChatMessageModel msg)
        {
            if (msg == null || msg.FromUserId == 0 || msg.ToUserId == 0)
            {
                return(false);
            }

            return(_storage.UseConnection <bool>(connection =>
            {
                string sql = @"INSERT INTO dbo.chat_msg( pk_id , user_id ,room_id ,msg ,create_at,timestamp ) VALUES  ( @msgid , @uid ,  @roomid ,@msg , @create,@timestamp)";

                var result = connection.Execute(sql,
                                                new
                {
                    msgid = Guid.NewGuid().ToString(),
                    uid = msg.FromUserId,
                    roomid = CreateRoom(msg.FromUserId, msg.ToUserId, msg.Type),
                    msg = msg.Message,
                    create = msg.CreateAt,
                    timestamp = msg.TimeStamp
                });
                return result > 0;
            }));
        }
Example #2
0
 public virtual bool AddChatMsg(LayimChatMessageModel msg)
 {
     throw new NotImplementedException();
 }