Skip to content

Commit

Permalink
Modify server db
Browse files Browse the repository at this point in the history
  • Loading branch information
geoje committed May 31, 2021
1 parent 9d17d8c commit 0a3bde5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Server/Classes/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Server/Classes/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,11 @@ public static Chat GetLastChat(Room room)
}
return null;
}
public static List<Chat> GetChats(string roomId, DateTime until)
public static List<Chat> GetChats(Room room, DateTime until)
{
List<Chat> chats = new List<Chat>();
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);
Expand Down

0 comments on commit 0a3bde5

Please sign in to comment.