Incomplete King Of The Hill code

This commit is contained in:
2019-06-09 17:13:52 +10:00
parent efc6e6f150
commit a6846fd456
4 changed files with 39 additions and 4 deletions
+9
View File
@@ -109,6 +109,14 @@ const isSpying = (connection, user, cb) => {
});
};
const getLadderData = (connection, start, length, cb) => {
//moved here for reusability
let query = 'SELECT accounts.id AS id, username, soldiers, recruits, gold FROM accounts JOIN profiles ON accounts.id = profiles.accountId ORDER BY soldiers DESC, recruits DESC, gold DESC LIMIT ?, ?;';
connection.query(query, [start, length], (err, results) => {
cb(err, results);
});
};
const logActivity = (connection, id) => {
let query = 'UPDATE accounts SET lastActivityTime = CURRENT_TIMESTAMP() WHERE id = ?;';
connection.query(query, [id], (err) => {
@@ -123,5 +131,6 @@ module.exports = {
getBadgesOwned: getBadgesOwned,
isAttacking: isAttacking,
isSpying: isSpying,
getLadderData: getLadderData,
logActivity: logActivity
};