Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
127576b03f | |||
5d4cb4cce0 | |||
2c7d0a321e | |||
4196dbf591 | |||
4c8f0b27a1 | |||
5f6fc31344 | |||
e23b2464b8 |
@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## 2023.8.18
|
||||||
|
|
||||||
|
- Fix Auto Renewall Cronjob
|
||||||
|
- Add comment to Mikrotik User
|
||||||
|
|
||||||
## 2023.8.16
|
## 2023.8.16
|
||||||
|
|
||||||
- Admin Can Add Balance to Customer
|
- Admin Can Add Balance to Customer
|
||||||
|
@ -55,7 +55,7 @@ CREATE TABLE
|
|||||||
`address` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
|
`address` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
|
||||||
`phonenumber` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
|
`phonenumber` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
|
||||||
`email` varchar(128) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1',
|
`email` varchar(128) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1',
|
||||||
`balance` decimal(15,2) NOT NULL COMMENT 'For Money Deposit',
|
`balance` decimal(15,2) NOT NULL DEFAULT 0.00 COMMENT 'For Money Deposit',
|
||||||
`auto_renewal` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Auto renewal from balance',
|
`auto_renewal` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Auto renewal from balance',
|
||||||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
`last_login` datetime DEFAULT NULL
|
`last_login` datetime DEFAULT NULL
|
||||||
|
@ -19,17 +19,17 @@ class Balance
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
if ($config['allow_balance_transfer'] == 'yes') {
|
if ($config['allow_balance_transfer'] == 'yes') {
|
||||||
if(Balance::min($id_customer, $amount)){
|
if (Balance::min($id_customer, $amount)) {
|
||||||
if(Balance::plusByPhone($phoneTarget, $amount)){
|
if (Balance::plusByPhone($phoneTarget, $amount)) {
|
||||||
return true;
|
return true;
|
||||||
}else{
|
} else {
|
||||||
Balance::plus($id_customer, $amount);
|
Balance::plus($id_customer, $amount);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ class Balance
|
|||||||
{
|
{
|
||||||
$c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
|
$c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
|
||||||
if ($c && $c['balance'] >= $amount) {
|
if ($c && $c['balance'] >= $amount) {
|
||||||
$c->balance = $amount - $c['balance'];
|
$c->balance = $c['balance'] - $amount;
|
||||||
$c->save();
|
$c->save();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -49,7 +49,7 @@ class Balance
|
|||||||
public static function plusByPhone($phone_customer, $amount)
|
public static function plusByPhone($phone_customer, $amount)
|
||||||
{
|
{
|
||||||
$c = ORM::for_table('tbl_customers')->where('username', $phone_customer)->find_one();
|
$c = ORM::for_table('tbl_customers')->where('username', $phone_customer)->find_one();
|
||||||
if($c){
|
if ($c) {
|
||||||
$c->balance = $amount + $c['balance'];
|
$c->balance = $amount + $c['balance'];
|
||||||
$c->save();
|
$c->save();
|
||||||
return true;
|
return true;
|
||||||
@ -61,7 +61,7 @@ class Balance
|
|||||||
{
|
{
|
||||||
$c = ORM::for_table('tbl_customers')->where('username', $phone_customer)->find_one();
|
$c = ORM::for_table('tbl_customers')->where('username', $phone_customer)->find_one();
|
||||||
if ($c && $c['balance'] >= $amount) {
|
if ($c && $c['balance'] >= $amount) {
|
||||||
$c->balance = $amount - $c['balance'];
|
$c->balance = $c['balance'] - $amount;
|
||||||
$c->save();
|
$c->save();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -4,8 +4,9 @@ use PEAR2\Net\RouterOS;
|
|||||||
|
|
||||||
class Mikrotik
|
class Mikrotik
|
||||||
{
|
{
|
||||||
public static function info($name){
|
public static function info($name)
|
||||||
$d = ORM::for_table('tbl_routers')->where('name',$name)->find_one();
|
{
|
||||||
|
$d = ORM::for_table('tbl_routers')->where('name', $name)->find_one();
|
||||||
return $d;
|
return $d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,7 +20,8 @@ class Mikrotik
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isUserLogin($client, $username){
|
public static function isUserLogin($client, $username)
|
||||||
|
{
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ip hotspot active print',
|
'/ip hotspot active print',
|
||||||
RouterOS\Query::where('user', $username)
|
RouterOS\Query::where('user', $username)
|
||||||
@ -27,7 +29,8 @@ class Mikrotik
|
|||||||
return $client->sendSync($printRequest)->getProperty('.id');
|
return $client->sendSync($printRequest)->getProperty('.id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function logMeIn($client, $user, $pass, $ip, $mac){
|
public static function logMeIn($client, $user, $pass, $ip, $mac)
|
||||||
|
{
|
||||||
$addRequest = new RouterOS\Request('/ip/hotspot/active/login');
|
$addRequest = new RouterOS\Request('/ip/hotspot/active/login');
|
||||||
$client->sendSync(
|
$client->sendSync(
|
||||||
$addRequest
|
$addRequest
|
||||||
@ -38,7 +41,8 @@ class Mikrotik
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function logMeOut($client, $user){
|
public static function logMeOut($client, $user)
|
||||||
|
{
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ip hotspot active print',
|
'/ip hotspot active print',
|
||||||
RouterOS\Query::where('user', $user)
|
RouterOS\Query::where('user', $user)
|
||||||
@ -51,7 +55,8 @@ class Mikrotik
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function addHotspotPlan($client, $name, $sharedusers, $rate){
|
public static function addHotspotPlan($client, $name, $sharedusers, $rate)
|
||||||
|
{
|
||||||
$addRequest = new RouterOS\Request('/ip/hotspot/user/profile/add');
|
$addRequest = new RouterOS\Request('/ip/hotspot/user/profile/add');
|
||||||
$client->sendSync(
|
$client->sendSync(
|
||||||
$addRequest
|
$addRequest
|
||||||
@ -61,7 +66,8 @@ class Mikrotik
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setHotspotPlan($client, $name, $sharedusers, $rate){
|
public static function setHotspotPlan($client, $name, $sharedusers, $rate)
|
||||||
|
{
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ip hotspot user profile print .proplist=name',
|
'/ip hotspot user profile print .proplist=name',
|
||||||
RouterOS\Query::where('name', $name)
|
RouterOS\Query::where('name', $name)
|
||||||
@ -77,7 +83,8 @@ class Mikrotik
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function removeHotspotPlan($client, $name){
|
public static function removeHotspotPlan($client, $name)
|
||||||
|
{
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ip hotspot user profile print .proplist=name',
|
'/ip hotspot user profile print .proplist=name',
|
||||||
RouterOS\Query::where('name', $name)
|
RouterOS\Query::where('name', $name)
|
||||||
@ -119,6 +126,8 @@ class Mikrotik
|
|||||||
->setArgument('name', $customer['username'])
|
->setArgument('name', $customer['username'])
|
||||||
->setArgument('profile', $plan['name_plan'])
|
->setArgument('profile', $plan['name_plan'])
|
||||||
->setArgument('password', $customer['password'])
|
->setArgument('password', $customer['password'])
|
||||||
|
->setArgument('comment', $customer['fullname'])
|
||||||
|
->setArgument('email', $customer['email'])
|
||||||
->setArgument('limit-uptime', $timelimit)
|
->setArgument('limit-uptime', $timelimit)
|
||||||
);
|
);
|
||||||
} else if ($plan['limit_type'] == "Data_Limit") {
|
} else if ($plan['limit_type'] == "Data_Limit") {
|
||||||
@ -131,6 +140,8 @@ class Mikrotik
|
|||||||
->setArgument('name', $customer['username'])
|
->setArgument('name', $customer['username'])
|
||||||
->setArgument('profile', $plan['name_plan'])
|
->setArgument('profile', $plan['name_plan'])
|
||||||
->setArgument('password', $customer['password'])
|
->setArgument('password', $customer['password'])
|
||||||
|
->setArgument('comment', $customer['fullname'])
|
||||||
|
->setArgument('email', $customer['email'])
|
||||||
->setArgument('limit-bytes-total', $datalimit)
|
->setArgument('limit-bytes-total', $datalimit)
|
||||||
);
|
);
|
||||||
} else if ($plan['limit_type'] == "Both_Limit") {
|
} else if ($plan['limit_type'] == "Both_Limit") {
|
||||||
@ -147,6 +158,8 @@ class Mikrotik
|
|||||||
->setArgument('name', $customer['username'])
|
->setArgument('name', $customer['username'])
|
||||||
->setArgument('profile', $plan['name_plan'])
|
->setArgument('profile', $plan['name_plan'])
|
||||||
->setArgument('password', $customer['password'])
|
->setArgument('password', $customer['password'])
|
||||||
|
->setArgument('comment', $customer['fullname'])
|
||||||
|
->setArgument('email', $customer['email'])
|
||||||
->setArgument('limit-uptime', $timelimit)
|
->setArgument('limit-uptime', $timelimit)
|
||||||
->setArgument('limit-bytes-total', $datalimit)
|
->setArgument('limit-bytes-total', $datalimit)
|
||||||
);
|
);
|
||||||
@ -156,12 +169,15 @@ class Mikrotik
|
|||||||
$addRequest
|
$addRequest
|
||||||
->setArgument('name', $customer['username'])
|
->setArgument('name', $customer['username'])
|
||||||
->setArgument('profile', $plan['name_plan'])
|
->setArgument('profile', $plan['name_plan'])
|
||||||
|
->setArgument('comment', $customer['fullname'])
|
||||||
|
->setArgument('email', $customer['email'])
|
||||||
->setArgument('password', $customer['password'])
|
->setArgument('password', $customer['password'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setHotspotUser($client, $user, $pass, $nuser= null){
|
public static function setHotspotUser($client, $user, $pass, $nuser = null)
|
||||||
|
{
|
||||||
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
|
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
|
||||||
$printRequest->setArgument('.proplist', '.id');
|
$printRequest->setArgument('.proplist', '.id');
|
||||||
$printRequest->setQuery(RouterOS\Query::where('name', $user));
|
$printRequest->setQuery(RouterOS\Query::where('name', $user));
|
||||||
@ -216,9 +232,9 @@ class Mikrotik
|
|||||||
public static function addPpoeUser($client, $plan, $customer)
|
public static function addPpoeUser($client, $plan, $customer)
|
||||||
{
|
{
|
||||||
$addRequest = new RouterOS\Request('/ppp/secret/add');
|
$addRequest = new RouterOS\Request('/ppp/secret/add');
|
||||||
if(!empty($customer['pppoe_password'])){
|
if (!empty($customer['pppoe_password'])) {
|
||||||
$pass = $customer['pppoe_password'];
|
$pass = $customer['pppoe_password'];
|
||||||
}else{
|
} else {
|
||||||
$pass = $customer['password'];
|
$pass = $customer['password'];
|
||||||
}
|
}
|
||||||
$client->sendSync(
|
$client->sendSync(
|
||||||
@ -226,11 +242,13 @@ class Mikrotik
|
|||||||
->setArgument('name', $customer['username'])
|
->setArgument('name', $customer['username'])
|
||||||
->setArgument('service', 'pppoe')
|
->setArgument('service', 'pppoe')
|
||||||
->setArgument('profile', $plan['name_plan'])
|
->setArgument('profile', $plan['name_plan'])
|
||||||
|
->setArgument('comment', $customer['fullname'] . ' | ' . $customer['email'])
|
||||||
->setArgument('password', $pass)
|
->setArgument('password', $pass)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setPpoeUser($client, $user, $pass, $nuser= null){
|
public static function setPpoeUser($client, $user, $pass, $nuser = null)
|
||||||
|
{
|
||||||
$printRequest = new RouterOS\Request('/ppp/secret/print');
|
$printRequest = new RouterOS\Request('/ppp/secret/print');
|
||||||
$printRequest->setArgument('.proplist', '.id');
|
$printRequest->setArgument('.proplist', '.id');
|
||||||
$printRequest->setQuery(RouterOS\Query::where('name', $user));
|
$printRequest->setQuery(RouterOS\Query::where('name', $user));
|
||||||
@ -266,7 +284,8 @@ class Mikrotik
|
|||||||
$client->sendSync($removeRequest);
|
$client->sendSync($removeRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function removePool($client, $name){
|
public static function removePool($client, $name)
|
||||||
|
{
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ip pool print .proplist=name',
|
'/ip pool print .proplist=name',
|
||||||
RouterOS\Query::where('name', $name)
|
RouterOS\Query::where('name', $name)
|
||||||
@ -274,29 +293,33 @@ class Mikrotik
|
|||||||
$poolName = $client->sendSync($printRequest)->getProperty('name');
|
$poolName = $client->sendSync($printRequest)->getProperty('name');
|
||||||
|
|
||||||
$removeRequest = new RouterOS\Request('/ip/pool/remove');
|
$removeRequest = new RouterOS\Request('/ip/pool/remove');
|
||||||
$client($removeRequest
|
$client(
|
||||||
->setArgument('numbers', $poolName)
|
$removeRequest
|
||||||
|
->setArgument('numbers', $poolName)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function addPool($client, $name, $ip_address){
|
public static function addPool($client, $name, $ip_address)
|
||||||
|
{
|
||||||
$addRequest = new RouterOS\Request('/ip/pool/add');
|
$addRequest = new RouterOS\Request('/ip/pool/add');
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
->setArgument('name', $name)
|
$addRequest
|
||||||
->setArgument('ranges', $ip_address)
|
->setArgument('name', $name)
|
||||||
|
->setArgument('ranges', $ip_address)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setPool($client, $name, $ip_address){
|
public static function setPool($client, $name, $ip_address)
|
||||||
|
{
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ip pool print .proplist=name',
|
'/ip pool print .proplist=name',
|
||||||
RouterOS\Query::where('name', $name)
|
RouterOS\Query::where('name', $name)
|
||||||
);
|
);
|
||||||
$poolName = $client->sendSync($printRequest)->getProperty('name');
|
$poolName = $client->sendSync($printRequest)->getProperty('name');
|
||||||
|
|
||||||
if(empty($poolName)){
|
if (empty($poolName)) {
|
||||||
self::addPool($client, $name, $ip_address);
|
self::addPool($client, $name, $ip_address);
|
||||||
}else{
|
} else {
|
||||||
$setRequest = new RouterOS\Request('/ip/pool/set');
|
$setRequest = new RouterOS\Request('/ip/pool/set');
|
||||||
$client(
|
$client(
|
||||||
$setRequest
|
$setRequest
|
||||||
@ -307,7 +330,8 @@ class Mikrotik
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function addPpoePlan($client, $name, $pool, $rate){
|
public static function addPpoePlan($client, $name, $pool, $rate)
|
||||||
|
{
|
||||||
$addRequest = new RouterOS\Request('/ppp/profile/add');
|
$addRequest = new RouterOS\Request('/ppp/profile/add');
|
||||||
$client->sendSync(
|
$client->sendSync(
|
||||||
$addRequest
|
$addRequest
|
||||||
@ -318,15 +342,16 @@ class Mikrotik
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setPpoePlan($client, $name, $pool, $rate){
|
public static function setPpoePlan($client, $name, $pool, $rate)
|
||||||
|
{
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ppp profile print .proplist=name',
|
'/ppp profile print .proplist=name',
|
||||||
RouterOS\Query::where('name', $name)
|
RouterOS\Query::where('name', $name)
|
||||||
);
|
);
|
||||||
$profileName = $client->sendSync($printRequest)->getProperty('name');
|
$profileName = $client->sendSync($printRequest)->getProperty('name');
|
||||||
if(empty($profileName)){
|
if (empty($profileName)) {
|
||||||
self::addPpoePlan($client, $name, $pool, $rate);
|
self::addPpoePlan($client, $name, $pool, $rate);
|
||||||
}else{
|
} else {
|
||||||
$setRequest = new RouterOS\Request('/ppp/profile/set');
|
$setRequest = new RouterOS\Request('/ppp/profile/set');
|
||||||
$client(
|
$client(
|
||||||
$setRequest
|
$setRequest
|
||||||
@ -338,7 +363,8 @@ class Mikrotik
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function removePpoePlan($client, $name){
|
public static function removePpoePlan($client, $name)
|
||||||
|
{
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ppp profile print .proplist=name',
|
'/ppp profile print .proplist=name',
|
||||||
RouterOS\Query::where('name', $name)
|
RouterOS\Query::where('name', $name)
|
||||||
|
@ -33,7 +33,7 @@ class Package
|
|||||||
|
|
||||||
if ($router_name == 'balance') {
|
if ($router_name == 'balance') {
|
||||||
// insert table transactions
|
// insert table transactions
|
||||||
$inv = "INV-" . _raid(5);
|
$inv = "INV-" . Package::_raid(5);
|
||||||
$t = ORM::for_table('tbl_transactions')->create();
|
$t = ORM::for_table('tbl_transactions')->create();
|
||||||
$t->invoice = $inv;
|
$t->invoice = $inv;
|
||||||
$t->username = $c['username'];
|
$t->username = $c['username'];
|
||||||
@ -114,7 +114,7 @@ class Package
|
|||||||
|
|
||||||
// insert table transactions
|
// insert table transactions
|
||||||
$t = ORM::for_table('tbl_transactions')->create();
|
$t = ORM::for_table('tbl_transactions')->create();
|
||||||
$t->invoice = "INV-" . _raid(5);
|
$t->invoice = "INV-" . Package::_raid(5);
|
||||||
$t->username = $c['username'];
|
$t->username = $c['username'];
|
||||||
$t->plan_name = $p['name_plan'];
|
$t->plan_name = $p['name_plan'];
|
||||||
$t->price = $p['price'];
|
$t->price = $p['price'];
|
||||||
@ -147,7 +147,7 @@ class Package
|
|||||||
|
|
||||||
// insert table transactions
|
// insert table transactions
|
||||||
$t = ORM::for_table('tbl_transactions')->create();
|
$t = ORM::for_table('tbl_transactions')->create();
|
||||||
$t->invoice = "INV-" . _raid(5);
|
$t->invoice = "INV-" . Package::_raid(5);
|
||||||
$t->username = $c['username'];
|
$t->username = $c['username'];
|
||||||
$t->plan_name = $p['name_plan'];
|
$t->plan_name = $p['name_plan'];
|
||||||
$t->price = $p['price'];
|
$t->price = $p['price'];
|
||||||
@ -188,7 +188,7 @@ class Package
|
|||||||
|
|
||||||
// insert table transactions
|
// insert table transactions
|
||||||
$t = ORM::for_table('tbl_transactions')->create();
|
$t = ORM::for_table('tbl_transactions')->create();
|
||||||
$t->invoice = "INV-" . _raid(5);
|
$t->invoice = "INV-" . Package::_raid(5);
|
||||||
$t->username = $c['username'];
|
$t->username = $c['username'];
|
||||||
$t->plan_name = $p['name_plan'];
|
$t->plan_name = $p['name_plan'];
|
||||||
$t->price = $p['price'];
|
$t->price = $p['price'];
|
||||||
@ -221,7 +221,7 @@ class Package
|
|||||||
|
|
||||||
// insert table transactions
|
// insert table transactions
|
||||||
$t = ORM::for_table('tbl_transactions')->create();
|
$t = ORM::for_table('tbl_transactions')->create();
|
||||||
$t->invoice = "INV-" . _raid(5);
|
$t->invoice = "INV-" . Package::_raid(5);
|
||||||
$t->username = $c['username'];
|
$t->username = $c['username'];
|
||||||
$t->plan_name = $p['name_plan'];
|
$t->plan_name = $p['name_plan'];
|
||||||
$t->price = $p['price'];
|
$t->price = $p['price'];
|
||||||
@ -301,4 +301,10 @@ class Package
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function _raid($l)
|
||||||
|
{
|
||||||
|
return substr(str_shuffle(str_repeat('0123456789', $l)), 0, $l);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,10 +191,6 @@ function _admin($login = true)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _raid($l)
|
|
||||||
{
|
|
||||||
return substr(str_shuffle(str_repeat('0123456789', $l)), 0, $l);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _log($description, $type = '', $userid = '0')
|
function _log($description, $type = '', $userid = '0')
|
||||||
{
|
{
|
||||||
|
@ -168,7 +168,7 @@ $style
|
|||||||
$html
|
$html
|
||||||
EOF;
|
EOF;
|
||||||
$mpdf->WriteHTML($nhtml);
|
$mpdf->WriteHTML($nhtml);
|
||||||
$mpdf->Output(date('Y-m-d') . _raid(4) . '.pdf', 'D');
|
$mpdf->Output(date('Y-m-d') . Package::_raid(4) . '.pdf', 'D');
|
||||||
} else {
|
} else {
|
||||||
echo 'No Data';
|
echo 'No Data';
|
||||||
}
|
}
|
||||||
@ -340,7 +340,7 @@ $style
|
|||||||
$html
|
$html
|
||||||
EOF;
|
EOF;
|
||||||
$mpdf->WriteHTML($nhtml);
|
$mpdf->WriteHTML($nhtml);
|
||||||
$mpdf->Output(date('Y-m-d') . _raid(4) . '.pdf', 'D');
|
$mpdf->Output(date('Y-m-d') . Package::_raid(4) . '.pdf', 'D');
|
||||||
} else {
|
} else {
|
||||||
echo 'No Data';
|
echo 'No Data';
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ switch ($action) {
|
|||||||
|
|
||||||
// insert table transactions
|
// insert table transactions
|
||||||
$t = ORM::for_table('tbl_transactions')->create();
|
$t = ORM::for_table('tbl_transactions')->create();
|
||||||
$t->invoice = "INV-" . _raid(5);
|
$t->invoice = "INV-" . Package::_raid(5);
|
||||||
$t->username = $c['username'];
|
$t->username = $c['username'];
|
||||||
$t->plan_name = $p['name_plan'];
|
$t->plan_name = $p['name_plan'];
|
||||||
$t->price = $p['price'];
|
$t->price = $p['price'];
|
||||||
@ -106,7 +106,7 @@ switch ($action) {
|
|||||||
|
|
||||||
// insert table transactions
|
// insert table transactions
|
||||||
$t = ORM::for_table('tbl_transactions')->create();
|
$t = ORM::for_table('tbl_transactions')->create();
|
||||||
$t->invoice = "INV-" . _raid(5);
|
$t->invoice = "INV-" . Package::_raid(5);
|
||||||
$t->username = $c['username'];
|
$t->username = $c['username'];
|
||||||
$t->plan_name = $p['name_plan'];
|
$t->plan_name = $p['name_plan'];
|
||||||
$t->price = $p['price'];
|
$t->price = $p['price'];
|
||||||
@ -150,7 +150,7 @@ switch ($action) {
|
|||||||
|
|
||||||
// insert table transactions
|
// insert table transactions
|
||||||
$t = ORM::for_table('tbl_transactions')->create();
|
$t = ORM::for_table('tbl_transactions')->create();
|
||||||
$t->invoice = "INV-" . _raid(5);
|
$t->invoice = "INV-" . Package::_raid(5);
|
||||||
$t->username = $c['username'];
|
$t->username = $c['username'];
|
||||||
$t->plan_name = $p['name_plan'];
|
$t->plan_name = $p['name_plan'];
|
||||||
$t->price = $p['price'];
|
$t->price = $p['price'];
|
||||||
@ -183,7 +183,7 @@ switch ($action) {
|
|||||||
|
|
||||||
// insert table transactions
|
// insert table transactions
|
||||||
$t = ORM::for_table('tbl_transactions')->create();
|
$t = ORM::for_table('tbl_transactions')->create();
|
||||||
$t->invoice = "INV-" . _raid(5);
|
$t->invoice = "INV-" . Package::_raid(5);
|
||||||
$t->username = $c['username'];
|
$t->username = $c['username'];
|
||||||
$t->plan_name = $p['name_plan'];
|
$t->plan_name = $p['name_plan'];
|
||||||
$t->price = $p['price'];
|
$t->price = $p['price'];
|
||||||
|
@ -59,6 +59,9 @@ $result = ORM::for_table('tbl_appconfig')->find_many();
|
|||||||
foreach ($result as $value) {
|
foreach ($result as $value) {
|
||||||
$config[$value['setting']] = $value['value'];
|
$config[$value['setting']] = $value['value'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$_c = $config;
|
||||||
|
|
||||||
date_default_timezone_set($config['timezone']);
|
date_default_timezone_set($config['timezone']);
|
||||||
|
|
||||||
$textExpired = $_notifmsg['expired'];
|
$textExpired = $_notifmsg['expired'];
|
||||||
@ -95,12 +98,20 @@ foreach ($d as $ds) {
|
|||||||
if (Package::rechargeUser($ds['customer_id'], $p['routers'], $p['id'], 'Customer', 'Balance')) {
|
if (Package::rechargeUser($ds['customer_id'], $p['routers'], $p['id'], 'Customer', 'Balance')) {
|
||||||
// if success, then get the balance
|
// if success, then get the balance
|
||||||
Balance::min($ds['customer_id'], $p['price']);
|
Balance::min($ds['customer_id'], $p['price']);
|
||||||
|
echo "plan enabled: $p[enabled] | User balance: $c[balance] | price $p[price]\n";
|
||||||
|
echo "auto renewall Success\n";
|
||||||
} else {
|
} else {
|
||||||
|
echo "plan enabled: $p[enabled] | User balance: $c[balance] | price $p[price]\n";
|
||||||
|
echo "auto renewall Failed\n";
|
||||||
Message::sendTelegram("FAILED RENEWAL #cron\n\n#u$c[username] #buy #Hotspot \n" . $p['name_plan'] .
|
Message::sendTelegram("FAILED RENEWAL #cron\n\n#u$c[username] #buy #Hotspot \n" . $p['name_plan'] .
|
||||||
"\nRouter: " . $router_name .
|
"\nRouter: " . $router_name .
|
||||||
"\nPrice: " . $p['price']);
|
"\nPrice: " . $p['price']);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
echo "no renewall | plan enabled: $p[enabled] | User balance: $c[balance] | price $p[price]\n";
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
echo "no renewall | balance $config[enable_balance] auto_renewal $c[auto_renewal]\n";
|
||||||
}
|
}
|
||||||
} else echo " : ACTIVE \r\n";
|
} else echo " : ACTIVE \r\n";
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"version": "2023.8.16"
|
"version": "2023.8.18"
|
||||||
}
|
}
|
Reference in New Issue
Block a user