Füge UndergroundWorker hinzu und implementiere Logik für unterirdische Aufgaben. Aktualisiere CMakeLists.txt, um neue Quell- und Header-Dateien einzuschließen. Verbessere die Fehlerbehandlung in der Datenbank und sende Benachrichtigungen nach bestimmten Ereignissen. Integriere Hilfsfunktionen zur sicheren Verarbeitung von Daten.
This commit is contained in:
committed by
Torsten (PC)
parent
1451225978
commit
23c07a3570
@@ -180,6 +180,15 @@ void PoliticsWorker::notifyOfficeExpirations() {
|
||||
signalActivity();
|
||||
db.execute("NOTIFY_OFFICE_EXPIRATION");
|
||||
signalActivity();
|
||||
|
||||
// Sende falukantUpdateStatus an alle betroffenen Benutzer
|
||||
db.prepare("GET_USERS_WITH_EXPIRING_OFFICES", QUERY_GET_USERS_WITH_EXPIRING_OFFICES);
|
||||
const auto affectedUsers = db.execute("GET_USERS_WITH_EXPIRING_OFFICES");
|
||||
for (const auto &user : affectedUsers) {
|
||||
int userId = std::stoi(user.at("user_id"));
|
||||
nlohmann::json message = { { "event", "falukantUpdateStatus" } };
|
||||
sendMessageToFalukantUsers(userId, message);
|
||||
}
|
||||
}
|
||||
|
||||
void PoliticsWorker::notifyElectionCreated(const std::vector<std::pair<int,int>>& elections) {
|
||||
@@ -192,6 +201,15 @@ void PoliticsWorker::notifyElectionCreated(const std::vector<std::pair<int,int>>
|
||||
db.execute("NOTIFY_ELECTION_CREATED", { std::to_string(pr.first) });
|
||||
signalActivity();
|
||||
}
|
||||
|
||||
// Sende falukantUpdateStatus an alle betroffenen Benutzer
|
||||
db.prepare("GET_USERS_IN_REGIONS_WITH_ELECTIONS", QUERY_GET_USERS_IN_REGIONS_WITH_ELECTIONS);
|
||||
const auto affectedUsers = db.execute("GET_USERS_IN_REGIONS_WITH_ELECTIONS");
|
||||
for (const auto &user : affectedUsers) {
|
||||
int userId = std::stoi(user.at("user_id"));
|
||||
nlohmann::json message = { { "event", "falukantUpdateStatus" } };
|
||||
sendMessageToFalukantUsers(userId, message);
|
||||
}
|
||||
}
|
||||
|
||||
void PoliticsWorker::notifyOfficeFilled(const std::vector<std::tuple<int,int,int,int>>& newOffices) {
|
||||
@@ -205,6 +223,15 @@ void PoliticsWorker::notifyOfficeFilled(const std::vector<std::tuple<int,int,int
|
||||
db.execute("NOTIFY_OFFICE_FILLED", { std::to_string(characterId) });
|
||||
signalActivity();
|
||||
}
|
||||
|
||||
// Sende falukantUpdateStatus an alle betroffenen Benutzer
|
||||
db.prepare("GET_USERS_WITH_FILLED_OFFICES", QUERY_GET_USERS_WITH_FILLED_OFFICES);
|
||||
const auto affectedUsers = db.execute("GET_USERS_WITH_FILLED_OFFICES");
|
||||
for (const auto &user : affectedUsers) {
|
||||
int userId = std::stoi(user.at("user_id"));
|
||||
nlohmann::json message = { { "event", "falukantUpdateStatus" } };
|
||||
sendMessageToFalukantUsers(userId, message);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::tuple<int,int,int,int>> PoliticsWorker::processElections() {
|
||||
|
||||
Reference in New Issue
Block a user