From 6e263ca4bd3ba5e74cb344d976a0339a2d2f89b4 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Wed, 12 Jun 2024 15:27:33 +0700 Subject: [PATCH] fix cron --- system/controllers/services.php | 18 +++++++++--------- system/cron.php | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/system/controllers/services.php b/system/controllers/services.php index 4ca9ea8d..24710b43 100644 --- a/system/controllers/services.php +++ b/system/controllers/services.php @@ -108,10 +108,10 @@ switch ($action) { } $ui->assign('devices', $devices); //select expired plan - if($d['is_radius']){ - $exps = ORM::for_table('tbl_plans')->selects('id','name_plan')->where("is_radius", 1)->findArray(); - }else{ - $exps = ORM::for_table('tbl_plans')->selects('id','name_plan')->where("routers", $d['routers'])->findArray(); + if ($d['is_radius']) { + $exps = ORM::for_table('tbl_plans')->selects('id', 'name_plan')->where('type', 'Hotspot')->where("is_radius", 1)->findArray(); + } else { + $exps = ORM::for_table('tbl_plans')->selects('id', 'name_plan')->where('type', 'Hotspot')->where("routers", $d['routers'])->findArray(); } $ui->assign('exps', $exps); run_hook('view_edit_plan'); #HOOK @@ -219,7 +219,7 @@ switch ($action) { new Exception(Lang::T("Devices Not Found")); } - r2(U . 'services/hotspot', 's', Lang::T('Data Created Successfully')); + r2(U . 'services/edit/' . $d->id(), 's', Lang::T('Data Created Successfully')); } else { r2(U . 'services/add', 'e', $msg); } @@ -387,10 +387,10 @@ switch ($action) { } $ui->assign('devices', $devices); //select expired plan - if($d['is_radius']){ - $exps = ORM::for_table('tbl_plans')->selects('id','name_plan')->where("is_radius", 1)->findArray(); - }else{ - $exps = ORM::for_table('tbl_plans')->selects('id','name_plan')->where("routers", $d['routers'])->findArray(); + if ($d['is_radius']) { + $exps = ORM::for_table('tbl_plans')->selects('id', 'name_plan')->where('type', 'PPPOE')->where("is_radius", 1)->findArray(); + } else { + $exps = ORM::for_table('tbl_plans')->selects('id', 'name_plan')->where('type', 'PPPOE')->where("routers", $d['routers'])->findArray(); } $ui->assign('exps', $exps); run_hook('view_edit_ppoe'); #HOOK diff --git a/system/cron.php b/system/cron.php index 95981528..099c315d 100644 --- a/system/cron.php +++ b/system/cron.php @@ -21,7 +21,7 @@ $textExpired = Lang::getNotifText('expired'); $d = ORM::for_table('tbl_user_recharges')->where('status', 'on')->where_lte('expiration', date("Y-m-d"))->find_many(); echo "Found " . count($d) . " user(s)\n"; -run_hook('cronjob'); #HOOK +//run_hook('cronjob'); #HOOK foreach ($d as $ds) { $date_now = strtotime(date("Y-m-d H:i:s")); @@ -35,7 +35,7 @@ foreach ($d as $ds) { $dvc = Package::getDevice($p); if (file_exists($dvc)) { require_once $dvc; - (new $p['device'])->remove_customer($ds['routers'], $c, $p); + (new $p['device'])->remove_customer($c, $p); } else { echo "Cron error Devices $p[device] not found, cannot disconnect $c[username]"; Message::sendTelegram("Cron error Devices $p[device] not found, cannot disconnect $c[username]");