1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-19 21:10:12 +02:00

Track last login time for accounts

This commit is contained in:
Ivan Savenko 2024-02-06 16:28:35 +02:00
parent 8cd6832297
commit 77f177adc7
2 changed files with 9 additions and 2 deletions

View File

@ -149,6 +149,12 @@ void LobbyDatabase::prepareStatements()
WHERE roomID = ?
)";
static const std::string updateAccountLoginTimeText = R"(
UPDATE accounts
SET lastLoginTime = CURRENT_TIMESTAMP
WHERE accountID = ?
)";
// SELECT FROM
static const std::string getRecentMessageHistoryText = R"(
@ -263,6 +269,7 @@ void LobbyDatabase::prepareStatements()
setAccountOnlineStatement = database->prepare(setAccountOnlineText);
setGameRoomStatusStatement = database->prepare(setGameRoomStatusText);
updateAccountLoginTimeStatement = database->prepare(updateAccountLoginTimeText);
getRecentMessageHistoryStatement = database->prepare(getRecentMessageHistoryText);
getIdleGameRoomStatement = database->prepare(getIdleGameRoomText);
@ -382,7 +389,7 @@ void LobbyDatabase::insertAccessCookie(const std::string & accountID, const std:
void LobbyDatabase::updateAccountLoginTime(const std::string & accountID)
{
assert(0);
updateAccountLoginTimeStatement->executeOnce(accountID);
}
std::string LobbyDatabase::getAccountDisplayName(const std::string & accountID)

View File

@ -33,7 +33,7 @@ class LobbyDatabase
SQLiteStatementPtr setAccountOnlineStatement;
SQLiteStatementPtr setGameRoomStatusStatement;
SQLiteStatementPtr setGameRoomPlayerLimitStatement;
SQLiteStatementPtr updateAccountLoginTimeStatement;
SQLiteStatementPtr getRecentMessageHistoryStatement;
SQLiteStatementPtr getIdleGameRoomStatement;