forked from kevinowino869/mitrobill
fix burst
This commit is contained in:
parent
8a1bfceab6
commit
29c8cb3ea1
@ -63,17 +63,21 @@ class MikrotikHotspot
|
|||||||
}
|
}
|
||||||
$mikrotik = $this->info($plan['routers']);
|
$mikrotik = $this->info($plan['routers']);
|
||||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||||
if ($plan['rate_down_unit'] == 'Kbps') {
|
$bw = ORM::for_table("tbl_bandwidth")->find_one($plan['id_bw']);
|
||||||
|
if ($bw['rate_down_unit'] == 'Kbps') {
|
||||||
$unitdown = 'K';
|
$unitdown = 'K';
|
||||||
} else {
|
} else {
|
||||||
$unitdown = 'M';
|
$unitdown = 'M';
|
||||||
}
|
}
|
||||||
if ($plan['rate_up_unit'] == 'Kbps') {
|
if ($bw['rate_up_unit'] == 'Kbps') {
|
||||||
$unitup = 'K';
|
$unitup = 'K';
|
||||||
} else {
|
} else {
|
||||||
$unitup = 'M';
|
$unitup = 'M';
|
||||||
}
|
}
|
||||||
$rate = $plan['rate_up'] . $unitup . "/" . $plan['rate_down'] . $unitdown;
|
$rate = $bw['rate_up'] . $unitup . "/" . $bw['rate_down'] . $unitdown;
|
||||||
|
if(!empty(trim($bw['burst']))){
|
||||||
|
$rate .= ' '.$bw['burst'];
|
||||||
|
}
|
||||||
$addRequest = new RouterOS\Request('/ip/hotspot/user/profile/add');
|
$addRequest = new RouterOS\Request('/ip/hotspot/user/profile/add');
|
||||||
$client->sendSync(
|
$client->sendSync(
|
||||||
$addRequest
|
$addRequest
|
||||||
@ -154,17 +158,21 @@ class MikrotikHotspot
|
|||||||
if (empty($profileID)) {
|
if (empty($profileID)) {
|
||||||
$this->add_plan($new_plan);
|
$this->add_plan($new_plan);
|
||||||
} else {
|
} else {
|
||||||
if ($new_plan['rate_down_unit'] == 'Kbps') {
|
$bw = ORM::for_table("tbl_bandwidth")->find_one($new_plan['id_bw']);
|
||||||
|
if ($bw['rate_down_unit'] == 'Kbps') {
|
||||||
$unitdown = 'K';
|
$unitdown = 'K';
|
||||||
} else {
|
} else {
|
||||||
$unitdown = 'M';
|
$unitdown = 'M';
|
||||||
}
|
}
|
||||||
if ($new_plan['rate_up_unit'] == 'Kbps') {
|
if ($bw['rate_up_unit'] == 'Kbps') {
|
||||||
$unitup = 'K';
|
$unitup = 'K';
|
||||||
} else {
|
} else {
|
||||||
$unitup = 'M';
|
$unitup = 'M';
|
||||||
}
|
}
|
||||||
$rate = $new_plan['rate_up'] . $unitup . "/" . $new_plan['rate_down'] . $unitdown;
|
$rate = $bw['rate_up'] . $unitup . "/" . $bw['rate_down'] . $unitdown;
|
||||||
|
if(!empty(trim($bw['burst']))){
|
||||||
|
$rate .= ' '.$bw['burst'];
|
||||||
|
}
|
||||||
$setRequest = new RouterOS\Request('/ip/hotspot/user/profile/set');
|
$setRequest = new RouterOS\Request('/ip/hotspot/user/profile/set');
|
||||||
$client->sendSync(
|
$client->sendSync(
|
||||||
$setRequest
|
$setRequest
|
||||||
|
@ -38,18 +38,21 @@ class Radius {
|
|||||||
|
|
||||||
function add_plan($plan)
|
function add_plan($plan)
|
||||||
{
|
{
|
||||||
if ($plan['rate_down_unit'] == 'Kbps') {
|
$bw = ORM::for_table("tbl_bandwidth")->find_one($plan['id_bw']);
|
||||||
|
if ($bw['rate_down_unit'] == 'Kbps') {
|
||||||
$unitdown = 'K';
|
$unitdown = 'K';
|
||||||
} else {
|
} else {
|
||||||
$unitdown = 'M';
|
$unitdown = 'M';
|
||||||
}
|
}
|
||||||
if ($plan['rate_up_unit'] == 'Kbps') {
|
if ($bw['rate_up_unit'] == 'Kbps') {
|
||||||
$unitup = 'K';
|
$unitup = 'K';
|
||||||
} else {
|
} else {
|
||||||
$unitup = 'M';
|
$unitup = 'M';
|
||||||
}
|
}
|
||||||
$rate = $plan['rate_up'] . $unitup . "/" . $plan['rate_down'] . $unitdown;
|
$rate = $bw['rate_up'] . $unitup . "/" . $bw['rate_down'] . $unitdown;
|
||||||
|
if(!empty(trim($bw['burst']))){
|
||||||
|
$rate .= ' '.$bw['burst'];
|
||||||
|
}
|
||||||
$rates = explode('/', $rate);
|
$rates = explode('/', $rate);
|
||||||
##burst fixed
|
##burst fixed
|
||||||
if (strpos($rate, ' ')) {
|
if (strpos($rate, ' ')) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user