mirror of
https://github.com/hotspotbilling/phpnuxbill.git
synced 2025-02-23 15:07:19 +08:00
fix burst
This commit is contained in:
parent
8a1bfceab6
commit
29c8cb3ea1
2 changed files with 21 additions and 10 deletions
|
@ -63,17 +63,21 @@ class MikrotikHotspot
|
|||
}
|
||||
$mikrotik = $this->info($plan['routers']);
|
||||
$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';
|
||||
} else {
|
||||
$unitdown = 'M';
|
||||
}
|
||||
if ($plan['rate_up_unit'] == 'Kbps') {
|
||||
if ($bw['rate_up_unit'] == 'Kbps') {
|
||||
$unitup = 'K';
|
||||
} else {
|
||||
$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');
|
||||
$client->sendSync(
|
||||
$addRequest
|
||||
|
@ -154,17 +158,21 @@ class MikrotikHotspot
|
|||
if (empty($profileID)) {
|
||||
$this->add_plan($new_plan);
|
||||
} 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';
|
||||
} else {
|
||||
$unitdown = 'M';
|
||||
}
|
||||
if ($new_plan['rate_up_unit'] == 'Kbps') {
|
||||
if ($bw['rate_up_unit'] == 'Kbps') {
|
||||
$unitup = 'K';
|
||||
} else {
|
||||
$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');
|
||||
$client->sendSync(
|
||||
$setRequest
|
||||
|
|
|
@ -38,18 +38,21 @@ class Radius {
|
|||
|
||||
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';
|
||||
} else {
|
||||
$unitdown = 'M';
|
||||
}
|
||||
if ($plan['rate_up_unit'] == 'Kbps') {
|
||||
if ($bw['rate_up_unit'] == 'Kbps') {
|
||||
$unitup = 'K';
|
||||
} else {
|
||||
$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);
|
||||
##burst fixed
|
||||
if (strpos($rate, ' ')) {
|
||||
|
|
Loading…
Reference in a new issue