fix a stupid error: queue for more tickets than capacity

This commit is contained in:
2024-05-25 01:18:24 +00:00
parent 10ee833002
commit 8cc179a0c2
3 changed files with 3 additions and 1 deletions

View File

@ -251,7 +251,7 @@ std::string TicketSystemEngine::BuyTicket(const std::string &command) {
available_seats = std::min(available_seats, (int)seats_data.seat[j]);
}
if (ticket_num > available_seats) {
if (accept_queue == "false") {
if (accept_queue == "false" || ticket_num > seats_data.max_seats) {
LOG->debug("no enough seats");
response_stream << "[" << command_id << "] -1";
return response_stream.str();