forked from kevinowino869/mitrobill
add option for check is customer online
This commit is contained in:
@ -85,20 +85,22 @@ switch ($action) {
|
||||
$ui->display('autoload.tpl');
|
||||
break;
|
||||
case 'customer_is_active':
|
||||
$c = ORM::for_table('tbl_customers')->where('username', $routes['2'])->find_one();
|
||||
$p = ORM::for_table('tbl_plans')->find_one($routes['3']);
|
||||
$dvc = Package::getDevice($p);
|
||||
if ($_app_stage != 'demo') {
|
||||
if (file_exists($dvc)) {
|
||||
require_once $dvc;
|
||||
try {
|
||||
//don't wait more than 5 seconds for response from device, otherwise we get timeout error.
|
||||
ini_set('default_socket_timeout', 5);
|
||||
if ((new $p['device'])->online_customer($c, $p['routers'])) {
|
||||
echo '<span class="label label-success" title="online"> </span>';
|
||||
if ($config['check_customer_online'] == 'yes') {
|
||||
$c = ORM::for_table('tbl_customers')->where('username', $routes['2'])->find_one();
|
||||
$p = ORM::for_table('tbl_plans')->find_one($routes['3']);
|
||||
$dvc = Package::getDevice($p);
|
||||
if ($_app_stage != 'demo') {
|
||||
if (file_exists($dvc)) {
|
||||
require_once $dvc;
|
||||
try {
|
||||
//don't wait more than 5 seconds for response from device, otherwise we get timeout error.
|
||||
ini_set('default_socket_timeout', 5);
|
||||
if ((new $p['device'])->online_customer($c, $p['routers'])) {
|
||||
echo '<span class="label label-success" title="online"> </span>';
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo '<span class="label label-danger" title="error"> </span>';
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo '<span class="label label-danger" title="error"> </span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -110,20 +112,22 @@ switch ($action) {
|
||||
$c = ORM::for_table('tbl_customers')->find_one($routes['2']);
|
||||
foreach ($ds as $d) {
|
||||
if ($d['status'] == 'on') {
|
||||
$p = ORM::for_table('tbl_plans')->find_one($d['plan_id']);
|
||||
$dvc = Package::getDevice($p);
|
||||
$status = "";
|
||||
if ($_app_stage != 'demo') {
|
||||
if (file_exists($dvc)) {
|
||||
require_once $dvc;
|
||||
try {
|
||||
//don't wait more than 5 seconds for response from device, otherwise we get timeout error.
|
||||
ini_set('default_socket_timeout', 5);
|
||||
if ((new $p['device'])->online_customer($c, $p['routers'])) {
|
||||
$status = '<span class="label label-success" title="online"> </span>';
|
||||
if ($config['check_customer_online'] == 'yes') {
|
||||
$p = ORM::for_table('tbl_plans')->find_one($d['plan_id']);
|
||||
$dvc = Package::getDevice($p);
|
||||
$status = "";
|
||||
if ($_app_stage != 'demo') {
|
||||
if (file_exists($dvc)) {
|
||||
require_once $dvc;
|
||||
try {
|
||||
//don't wait more than 5 seconds for response from device, otherwise we get timeout error.
|
||||
ini_set('default_socket_timeout', 5);
|
||||
if ((new $p['device'])->online_customer($c, $p['routers'])) {
|
||||
$status = '<span class="label label-success" title="online"> </span>';
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$status = '<span class="label label-danger" title="error"> </span>';
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$status = '<span class="label label-danger" title="error"> </span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user