update online user stat

This commit is contained in:
Tokumeikoi 2020-06-05 13:26:22 +08:00
parent 47a6c4077a
commit 49b60f7c23

View File

@ -26,7 +26,7 @@ class ServerController extends Controller
$server[$i]['tags'] = json_decode($server[$i]['tags']);
}
$server[$i]['group_id'] = json_decode($server[$i]['group_id']);
$serverStat = Cache::get(CacheKey::get('SERVER_STAT', $server[$i]['parent_id'] ? $server[$i]['parent_id'] : $server[$i]['id']));
$serverStat = Cache::get(CacheKey::get('SERVER_ONLINE_USER', $server[$i]['parent_id'] ? $server[$i]['parent_id'] : $server[$i]['id']));
if ($serverStat) {
$serverStat = json_decode($serverStat, true);
$server[$i]['u'] = $serverStat['u'];
@ -34,9 +34,9 @@ class ServerController extends Controller
$server[$i]['online'] = $serverStat['online'];
}
if ($server[$i]['parent_id']) {
$server[$i]['last_check_at'] = Cache::get('server_last_check_at_' . $server[$i]['parent_id']);
$server[$i]['last_check_at'] = Cache::get(CacheKey::get('SERVER_LAST_CHECK_AT', $server[$i]['parent_id']));
} else {
$server[$i]['last_check_at'] = Cache::get('server_last_check_at_' . $server[$i]['id']);
$server[$i]['last_check_at'] = Cache::get(CacheKey::get('SERVER_LAST_CHECK_AT', $server[$i]['id']));
}
}
return response([