diff --git a/src/transaction_system.cpp b/src/transaction_system.cpp index cb72010..8e79eca 100644 --- a/src/transaction_system.cpp +++ b/src/transaction_system.cpp @@ -346,6 +346,11 @@ std::string TicketSystemEngine::RefundTicket(const std::string &command) { } } } - response_stream << "[" << command_id << "] RefundTicket"; + hash_t user_ID_hash = SplitMix64Hash(user_name); + if (online_users.find(user_ID_hash) == online_users.end()) { + response_stream << "[" << command_id << "] -1"; + return response_stream.str(); + } + response_stream << "[" << command_id << "] 0"; return response_stream.str(); } \ No newline at end of file diff --git a/src/user_system.cpp b/src/user_system.cpp index e572bf7..5a33b91 100644 --- a/src/user_system.cpp +++ b/src/user_system.cpp @@ -89,6 +89,7 @@ std::string TicketSystemEngine::AddUser(const std::string &command) { strcpy(dat.name, name.c_str()); strcpy(dat.mailAddr, mailAddr.c_str()); user_data.Put(new_user_username_hash, dat); + transaction_manager.PrepareUserInfo(SplitMix64Hash(username)); LOG->debug("stored user_name hash: {}", new_user_username_hash); LOG->debug("stored user_name: {}", dat.username); LOG->debug("stored password hash: {}", dat.password_hash);