Burst Limit

This commit is contained in:
Ibnu Maksum
2024-02-19 18:03:40 +07:00
parent 91c90f05f8
commit cfb81596ae
8 changed files with 130 additions and 53 deletions

View File

@ -67,6 +67,7 @@ switch ($action) {
$rate_down_unit = _post('rate_down_unit');
$rate_up = _post('rate_up');
$rate_up_unit = _post('rate_up_unit');
$burst = _post('burst');
run_hook('add_bandwidth'); #HOOK
$msg = '';
if(Validator::Length($name,16,4) == false){
@ -88,6 +89,7 @@ switch ($action) {
$d->rate_down_unit = $rate_down_unit;
$d->rate_up = $rate_up;
$d->rate_up_unit = $rate_up_unit;
$d->burst = $burst;
$d->save();
r2(U . 'bandwidth/list', 's', Lang::T('Data Created Successfully'));
@ -102,6 +104,7 @@ switch ($action) {
$rate_down_unit = _post('rate_down_unit');
$rate_up = _post('rate_up');
$rate_up_unit = _post('rate_up_unit');
$burst = _post('burst');
run_hook('edit_bandwidth'); #HOOK
$msg = '';
if(Validator::Length($name,16,4) == false){
@ -128,6 +131,7 @@ switch ($action) {
$d->rate_down_unit = $rate_down_unit;
$d->rate_up = $rate_up;
$d->rate_up_unit = $rate_up_unit;
$d->burst = $burst;
$d->save();
r2(U . 'bandwidth/list', 's', Lang::T('Data Updated Successfully'));

View File

@ -173,7 +173,7 @@ switch ($action) {
Mikrotik::removeHotspotPlan($client, $d['name_plan']);
} catch (Exception $e) {
//ignore exception, it means router has already deleted
} catch(Throwable $e){
} catch (Throwable $e) {
//ignore exception, it means router has already deleted
}
}
@ -200,6 +200,7 @@ switch ($action) {
$validity_unit = _post('validity_unit');
$routers = _post('routers');
$pool_expired = _post('pool_expired');
$list_expired = _post('list_expired');
$enabled = _post('enabled');
$allow_purchase = _post('allow_purchase');
@ -243,6 +244,7 @@ switch ($action) {
}
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
$radiusRate = $b['rate_up'] . $radup . '/' . $b['rate_down'] . $raddown;
$rate = trim($rate . " " . $b['burst']);
$d = ORM::for_table('tbl_plans')->create();
$d->name_plan = $name;
@ -264,8 +266,9 @@ switch ($action) {
} else {
$d->is_radius = 0;
$d->routers = $routers;
$d->pool_expired = $pool_expired;
}
$d->pool_expired = $pool_expired;
$d->list_expired = $list_expired;
$d->enabled = $enabled;
$d->allow_purchase = $allow_purchase;
$d->save();
@ -305,6 +308,7 @@ switch ($action) {
$validity = _post('validity');
$validity_unit = _post('validity_unit');
$pool_expired = _post('pool_expired');
$list_expired = _post('list_expired');
$enabled = _post('enabled');
$allow_purchase = _post('allow_purchase');
$routers = _post('routers');
@ -343,6 +347,8 @@ switch ($action) {
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
$radiusRate = $b['rate_up'] . $radup . '/' . $b['rate_down'] . $raddown;
$rate = trim($rate . " " . $b['burst']);
if ($d['is_radius']) {
Radius::planUpSert($id, $radiusRate);
} else {
@ -367,6 +373,7 @@ switch ($action) {
$d->validity_unit = $validity_unit;
$d->shared_users = $sharedusers;
$d->pool_expired = $pool_expired;
$d->list_expired = $list_expired;
$d->enabled = $enabled;
$d->allow_purchase = $allow_purchase;
$d->save();
@ -443,7 +450,7 @@ switch ($action) {
Mikrotik::removePpoePlan($client, $d['name_plan']);
} catch (Exception $e) {
//ignore exception, it means router has already deleted
} catch(Throwable $e){
} catch (Throwable $e) {
//ignore exception, it means router has already deleted
}
}
@ -506,6 +513,7 @@ switch ($action) {
}
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
$radiusRate = $b['rate_up'] . $radup . '/' . $b['rate_down'] . $raddown;
$rate = trim($rate . " " . $b['burst']);
$d = ORM::for_table('tbl_plans')->create();
$d->type = 'PPPOE';
@ -593,6 +601,7 @@ switch ($action) {
}
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
$radiusRate = $b['rate_up'] . $radup . '/' . $b['rate_down'] . $raddown;
$rate = trim($rate . " " . $b['burst']);
if ($d['is_radius']) {
Radius::planUpSert($id, $radiusRate, $pool);

View File

@ -413,5 +413,9 @@
"Ward": "Ward",
"Credentials": "Credentials",
"Agent": "Agent",
"This_Token_will_act_as_SuperAdmin_Admin": "This Token will act as SuperAdmin\/Admin"
"This_Token_will_act_as_SuperAdmin_Admin": "This Token will act as SuperAdmin\/Admin",
"Login": "Login",
"Expired_Action": "Expired Action",
"Expired_Address_List_Name": "Expired Address List Name",
"Address_List": "Address List"
}

View File

@ -58,5 +58,9 @@
],
"2024.2.19": [
"CREATE TABLE `tbl_customers_fields` (`id` INT PRIMARY KEY AUTO_INCREMENT, `customer_id` INT NOT NULL, `field_name` VARCHAR(255) NOT NULL, `field_value` VARCHAR(255) NOT NULL, FOREIGN KEY (customer_id) REFERENCES tbl_customers(id));"
],
"2024.2.20" : [
"ALTER TABLE `tbl_plans` ADD `list_expired` VARCHAR(32) NOT NULL DEFAULT '' COMMENT 'address list' AFTER `pool_expired`;",
"ALTER TABLE `tbl_bandwidth` ADD `burst` VARCHAR(128) NOT NULL DEFAULT '' AFTER `rate_up_unit`;"
]
}