public override IEnumerable <LayimChatMessageViewModel> GetHistoryMessages(LayimHistoryParam param) { return(_storage.UseConnection <IEnumerable <LayimChatMessageViewModel> >(connection => { string timestampCondition = param.MsgTimestamp > 0 ? "AND A.[timestamp]<" + param.MsgTimestamp : ""; var sql = $@"SELECT TOP {param.Page} A.[user_id] AS [uid] , A.msg AS content , A.create_at AS addtime , A.[timestamp] , B.name , B.avatar FROM dbo.chat_msg A LEFT JOIN dbo.[user] B ON A.[user_id] = B.pk_id WHERE A.room_id='{CreateRoom(param.UserId, param.ToId, param.Type)}' {timestampCondition} ORDER BY A.[timestamp] desc"; var res = connection.Query <LayimChatMessageViewModel>(sql).ToList(); res.ForEach(x => x.self = x.uid == param.UserId); return res.OrderBy(x => x.timestamp); })); }
public virtual IEnumerable <LayimChatMessageViewModel> GetHistoryMessages(LayimHistoryParam param) { throw new NotImplementedException(); }