From 0a3bde589ddd316f6cbd16809f4bf4e247305317 Mon Sep 17 00:00:00 2001 From: GyeongHo Yang Date: Mon, 31 May 2021 20:58:33 +0900 Subject: [PATCH] Modify server db --- Server/Classes/Client.cs | 2 +- Server/Classes/Database.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Server/Classes/Client.cs b/Server/Classes/Client.cs index b870068..1ba7b33 100644 --- a/Server/Classes/Client.cs +++ b/Server/Classes/Client.cs @@ -217,7 +217,7 @@ public void Recieve() else Log("Room", $"{p.room.target} 채팅방 조회"); - Send(new ChatsPacket(Database.GetChats(p.room.id, p.until))); + Send(new ChatsPacket(Database.GetChats(p.room, p.until))); } } else if (packet.type == PacketType.Chat) diff --git a/Server/Classes/Database.cs b/Server/Classes/Database.cs index 7804f42..3b63292 100644 --- a/Server/Classes/Database.cs +++ b/Server/Classes/Database.cs @@ -289,11 +289,11 @@ public static Chat GetLastChat(Room room) } return null; } - public static List GetChats(string roomId, DateTime until) + public static List GetChats(Room room, DateTime until) { List chats = new List(); MySqlCommand cmd = new MySqlCommand( - $"SELECT * FROM chat WHERE room_id='{Filter(roomId)}'" + $"SELECT * FROM chat WHERE room_id='{Filter(room.id)}'" + "AND chat_date < @chat_date_until LIMIT 100", con); cmd.Parameters.AddWithValue("@chat_date_until", until);