mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 01:39:22 +02:00
Fix highscores error
This commit is contained in:
parent
9d119b6279
commit
a04fbde607
@ -135,6 +135,7 @@ if($settingHighscoresOutfit) {
|
|||||||
$configHighscoresPerPage = setting('core.highscores_per_page');
|
$configHighscoresPerPage = setting('core.highscores_per_page');
|
||||||
$limit = $configHighscoresPerPage + 1;
|
$limit = $configHighscoresPerPage + 1;
|
||||||
|
|
||||||
|
$highscores = [];
|
||||||
$needReCache = true;
|
$needReCache = true;
|
||||||
$cacheKey = 'highscores_' . $skill . '_' . $vocation . '_' . $page . '_' . $configHighscoresPerPage;
|
$cacheKey = 'highscores_' . $skill . '_' . $vocation . '_' . $page . '_' . $configHighscoresPerPage;
|
||||||
|
|
||||||
@ -158,7 +159,7 @@ $query->join('accounts', 'accounts.id', '=', 'players.account_id')
|
|||||||
->selectRaw('accounts.country, players.id, players.name, players.account_id, players.level, players.vocation' . $outfit . $promotion)
|
->selectRaw('accounts.country, players.id, players.name, players.account_id, players.level, players.vocation' . $outfit . $promotion)
|
||||||
->orderByDesc('value');
|
->orderByDesc('value');
|
||||||
|
|
||||||
if (!isset($highscores) || empty($highscores)) {
|
if (empty($highscores)) {
|
||||||
if ($skill >= POT::SKILL_FIRST && $skill <= POT::SKILL_LAST) { // skills
|
if ($skill >= POT::SKILL_FIRST && $skill <= POT::SKILL_LAST) { // skills
|
||||||
if ($db->hasColumn('players', 'skill_fist')) {// tfs 1.0
|
if ($db->hasColumn('players', 'skill_fist')) {// tfs 1.0
|
||||||
$skill_ids = array(
|
$skill_ids = array(
|
||||||
@ -201,17 +202,17 @@ if (!isset($highscores) || empty($highscores)) {
|
|||||||
$list = 'experience';
|
$list = 'experience';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$highscores = $query->get()->map(function($row) {
|
||||||
|
$tmp = $row->toArray();
|
||||||
|
$tmp['online'] = $row->online_status;
|
||||||
|
$tmp['vocation'] = $row->vocation_name;
|
||||||
|
unset($tmp['online_table']);
|
||||||
|
|
||||||
|
return $tmp;
|
||||||
|
})->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
$highscores = $query->get()->map(function($row) {
|
|
||||||
$tmp = $row->toArray();
|
|
||||||
$tmp['online'] = $row->online_status;
|
|
||||||
$tmp['vocation'] = $row->vocation_name;
|
|
||||||
unset($tmp['online_table']);
|
|
||||||
|
|
||||||
return $tmp;
|
|
||||||
})->toArray();
|
|
||||||
|
|
||||||
if ($cache->enabled() && $needReCache) {
|
if ($cache->enabled() && $needReCache) {
|
||||||
$cache->set($cacheKey, serialize($highscores), setting('core.highscores_cache_ttl') * 60);
|
$cache->set($cacheKey, serialize($highscores), setting('core.highscores_cache_ttl') * 60);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user