when code is empty, we shoudl return true if any operator is online

This commit is contained in:
everyx 2016-11-05 16:33:12 +08:00
parent 02c3e71dd9
commit 6dd2f86e99
3 changed files with 8 additions and 2 deletions

View File

@ -46,9 +46,15 @@ class OperatorStatusController extends AbstractController
$opcode = $request->query->get('code', false);
$online_operators = get_online_operators();
foreach ($online_operators as $item) {
if ($item['code'] == $opcode) {
if (count($online_operators) > 0) {
if (empty($opcode)) {
$is_online = "true";
} else {
foreach ($online_operators as $item) {
if ($item['code'] == $opcode) {
$is_online = "true";
}
}
}
}
$response = new Response($is_online);