"My Leaderboards" page
This commit is contained in:
parent
beea5e57c1
commit
fa408978fd
3 changed files with 41 additions and 3 deletions
|
@ -25,7 +25,7 @@ class leaderboard_create extends leaderboard_new
|
|||
$uid = $this->redis->incr($uid_key);
|
||||
}
|
||||
|
||||
$timestamp = Time::timestamp();
|
||||
$timestamp = time();
|
||||
|
||||
// Creates the rest of the data for the leaderboard
|
||||
$this->redis->multi()
|
||||
|
|
|
@ -5,9 +5,28 @@ class leaderboards extends UserModule
|
|||
public function __default()
|
||||
{
|
||||
// Grabs the user's leaderboards
|
||||
$leaderboards = array();
|
||||
$leaderboards = $this->redis->zrevrange('user:' . $this->uid . ':leaderboards:updated', 0, -1, 'WITHSCORES');
|
||||
$names = array();
|
||||
|
||||
return array('leaderboards' => $leaderboards);
|
||||
if ($leaderboards)
|
||||
{
|
||||
$this->redis->multi();
|
||||
|
||||
$leaderboard_uids = array();
|
||||
|
||||
foreach ($leaderboards as $uid => $updated_at)
|
||||
{
|
||||
$leaderboard_uids[] = $uid;
|
||||
$this->redis->hget('leaderboard:' . $uid, 'name');
|
||||
}
|
||||
|
||||
$names = array_combine($leaderboard_uids, $this->redis->exec());
|
||||
}
|
||||
|
||||
return array(
|
||||
'leaderboards' => $leaderboards,
|
||||
'names' => $names,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue