radius move to expired pool

This commit is contained in:
Ibnu Maksum 2023-10-16 10:15:45 +07:00
parent 92f072a861
commit 6a6434b39c
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
2 changed files with 15 additions and 5 deletions

View File

@ -283,7 +283,7 @@ class Radius
/**
* To insert or update existing customer Attribute
*/
private static function upsertCustomerAttr($username, $attr, $value, $op = ':=')
public static function upsertCustomerAttr($username, $attr, $value, $op = ':=')
{
$r = Radius::getTableCustomerAttr()->where_equal('username', $username)->whereEqual('attribute', $attr)->find_one();
if (!$r) {

View File

@ -103,8 +103,13 @@ foreach ($d as $ds) {
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
if ($p['is_radius']) {
echo Radius::customerDeactivate($c['username']);
}else{
if (!empty($p['pool_expired'])) {
print_r(Radius::customerDeactivate($c['username']));
} else {
Radius::upsertCustomerAttr($c['username'], 'Framed-Pool', $plan['pool_expired'], ':=');
print_r(Radius::disconnectCustomer($c['username']));
}
} else {
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
if (!empty($p['pool_expired'])) {
Mikrotik::setHotspotUserPackage($client, $c['username'], 'EXPIRED NUXBILL ' . $p['pool_expired']);
@ -152,8 +157,13 @@ foreach ($d as $ds) {
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
if ($p['is_radius']) {
echo Radius::customerDeactivate($c['username']);
}else{
if (!empty($p['pool_expired'])) {
print_r(Radius::customerDeactivate($c['username']));
} else {
Radius::upsertCustomerAttr($c['username'], 'Framed-Pool', $plan['pool_expired'], ':=');
print_r(Radius::disconnectCustomer($c['username']));
}
} else {
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
if (!empty($p['pool_expired'])) {
Mikrotik::setPpoeUserPlan($client, $c['username'], 'EXPIRED NUXBILL ' . $p['pool_expired']);