Fix Mikrotik-Rate-Limit burst

This commit is contained in:
Ibnu Maksum 2024-07-03 11:05:26 +07:00
parent 1704fe563d
commit 307abd64d3
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5

View File

@ -41,13 +41,11 @@ class Radius
$unitup = 'M';
}
$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, ' ')) {
$ratos = $rates[0] . '/' . $rates[1] . ' ' . $rates[2] . '/' . $rates[3] . '/' . $rates[4] . '/' . $rates[5] . '/' . $rates[6];
// cek jika punya burst
if (!empty(trim($bw['burst']))) {
$ratos = $rate . ' ' . $bw['burst'];
} else {
$ratos = $rates[0] . '/' . $rates[1];
}
@ -156,24 +154,6 @@ class Radius
return $n->save();
}
public function planUpSert($plan_id, $rate, $pool = null)
{
$rates = explode('/', $rate);
##burst fixed
if (strpos($rate, ' ')) {
$ratos = $rates[0] . '/' . $rates[1] . ' ' . $rates[2] . '/' . $rates[3] . '/' . $rates[4] . '/' . $rates[5] . '/' . $rates[6];
} else {
$ratos = $rates[0] . '/' . $rates[1];
}
$this->upsertPackage($plan_id, 'Ascend-Data-Rate', $this->stringToInteger($rates[1]), ':=');
$this->upsertPackage($plan_id, 'Ascend-Xmit-Rate', $this->stringToInteger($rates[0]), ':=');
$this->upsertPackage($plan_id, 'Mikrotik-Rate-Limit', $ratos, ':=');
// if ($pool != null) {
// $this->upsertPackage($plan_id, 'Framed-Pool', $pool, ':=');
// }
}
public function customerChangeUsername($from, $to)
{
$c = $this->getTableCustomer()->where_equal('username', $from)->findMany();