notif recharge to user

This commit is contained in:
Ibnu Maksum 2022-09-02 15:44:22 +07:00
parent a0dc6c7274
commit ba83833e94
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
4 changed files with 80 additions and 18 deletions

View File

@ -190,9 +190,6 @@ switch ($action) {
$t->routers = $server;
$t->type = "Hotspot";
$t->save();
sendTelegram( $c['username']." Activate Voucher Hotspot\n".$p['name_plan'].
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
} else {
try {
$iport = explode(":", $mikrotik['ip_address']);
@ -285,10 +282,10 @@ switch ($action) {
$t->routers = $server;
$t->type = "Hotspot";
$t->save();
sendTelegram( $c['username']." Activate Voucher Hotspot\n".$p['name_plan'].
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
}
sendTelegram( "$admin[fullname] Recharge Voucher Hotspot for $c[username]\n".$p['name_plan'].
"\nRouter: ".$server.
"\nPrice: ".$p['price']);
} else {
if ($b) {
@ -345,9 +342,6 @@ switch ($action) {
$t->routers = $server;
$t->type = "PPPOE";
$t->save();
sendTelegram( $c['username']." Activate Voucher PPPOE\n".$p['name_plan'].
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
} else {
try {
$iport = explode(":", $mikrotik['ip_address']);
@ -391,14 +385,34 @@ switch ($action) {
$t->routers = $server;
$t->type = "PPPOE";
$t->save();
sendTelegram( $c['username']." Activate Voucher PPPOE\n".$p['name_plan'].
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
}
sendTelegram( "$admin[fullname] Recharge Voucher PPPOE for $c[username]\n".$p['name_plan'].
"\nRouter: ".$server.
"\nPrice: ".$p['price']);
}
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
$ui->assign('in', $in);
sendSMS($c['username'], "*$_c[CompanyName]*\n".
"$_c[address]\n".
"$_c[phone]\n".
"\n\n".
"INVOICE: *$in[invoice]*\n".
"$_L[Date] : $date_now\n".
"$_L[Sales] : $admin[fullname]\n".
"\n\n".
"$_L[Type] : *$in[type]*\n".
"$_L[Plan_Name] : *$in[plan_name]*\n".
"$_L[Plan_Price] : *$_c[currency_code] ".number_format($in['price'],2,$_c['dec_point'],$_c['thousands_sep'])."*\n\n".
"$_L[Username] : *$in[username]*\n".
"$_L[Password] : **********\n\n".
"$_L[Created_On] :\n*".date($_c['date_format'], strtotime($in['recharged_on']))." $in[time]*\n".
"$_L[Expires_On] :\n*".date($_c['date_format'], strtotime($in['expiration']))." $in[time]*\n".
"\n\n".
"$_c[note]");
$ui->assign('date', $date_now);
$ui->display('invoice.tpl');
} else {
@ -894,6 +908,10 @@ switch ($action) {
$v1->status = "1";
$v1->user = $c['username'];
$v1->save();
sendTelegram( "$admin[fullname] Refill Voucher Hotspot for $c[username]\n".$p['name_plan'].
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
} else {
if ($b) {
try {
@ -997,10 +1015,34 @@ switch ($action) {
$v1->status = "1";
$v1->user = $c['username'];
$v1->save();
sendTelegram( "$admin[fullname] Refill Voucher PPPOE for $c[username]\n".$p['name_plan'].
"\nRouter: ".$v1['routers'].
"\nPrice: ".$p['price']);
}
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
$ui->assign('in', $in);
sendSMS($c['username'], "*$_c[CompanyName]*\n".
"$_c[address]\n".
"$_c[phone]\n".
"\n\n".
"INVOICE: *$in[invoice]*\n".
"$_L[Date] : $date_now\n".
"$_L[Sales] : $admin[fullname]\n".
"\n\n".
"$_L[Type] : *$in[type]*\n".
"$_L[Plan_Name] : *$in[plan_name]*\n".
"$_L[Plan_Price] : *$_c[currency_code] ".number_format($in['price'],2,$_c['dec_point'],$_c['thousands_sep'])."*\n\n".
"$_L[Username] : *$in[username]*\n".
"$_L[Password] : **********\n\n".
"$_L[Created_On] :\n*".date($_c['date_format'], strtotime($in['recharged_on']))." $in[time]*\n".
"$_L[Expires_On] :\n*".date($_c['date_format'], strtotime($in['expiration']))." $in[time]*\n".
"\n\n".
"$_c[note]");
$ui->assign('date', $date_now);
$ui->display('invoice.tpl');
} else {

View File

@ -15,6 +15,10 @@ $action = $routes['1'];
$admin = Admin::_info();
$ui->assign('_admin', $admin);
use PEAR2\Net\RouterOS;
require_once 'system/autoload/PEAR2/Autoload.php';
if($admin['user_type'] != 'Admin'){
r2(U."dashboard",'e',$_L['Do_Not_Access']);
}
@ -22,7 +26,7 @@ if($admin['user_type'] != 'Admin'){
switch ($action) {
case 'list':
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/routers.js"></script>');
$name = _post('name');
if ($name != ''){
$paginator = Paginator::bootstrap('tbl_routers','name','%'.$name.'%');
@ -31,7 +35,7 @@ switch ($action) {
$paginator = Paginator::bootstrap('tbl_routers');
$d = ORM::for_table('tbl_routers')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
$ui->assign('d',$d);
$ui->assign('paginator',$paginator);
$ui->display('routers.tpl');
@ -70,7 +74,7 @@ switch ($action) {
$username = _post('username');
$password = _post('password');
$description = _post('description');
$msg = '';
if(Validator::Length($name,30,4) == false){
$msg .= 'Name should be between 5 to 30 characters'. '<br>';
@ -78,12 +82,19 @@ switch ($action) {
if ($ip_address == '' OR $username == ''){
$msg .= $_L['All_field_is_required']. '<br>';
}
$d = ORM::for_table('tbl_routers')->where('ip_address',$ip_address)->find_one();
if($d){
$msg .= $_L['Router_already_exist']. '<br>';
}
try {
$iport = explode(":", $ip_address);
$client = new RouterOS\Client($iport[0], $username, $password, ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
$msg .= "Unable to connect to the router.<br>".$e->getMessage().'<br>';
}
if($msg == ''){
$d = ORM::for_table('tbl_routers')->create();
$d->name = $name;
@ -130,6 +141,15 @@ switch ($action) {
}
}
try {
$iport = explode(":", $ip_address);
$client = new RouterOS\Client($iport[0], $username, $password, ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
$msg .= "Unable to connect to the router.<br>".$e->getMessage().'<br>';
}
if($msg == ''){
$d->name = $name;
$d->ip_address = $ip_address;

View File

@ -50,7 +50,7 @@
</div>
</div>
</div>
<div class="panel-heading">SMS/Whatsapp Notification</div>
<div class="panel-heading">Whatsapp Notification</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">Server URL</label>

View File

@ -34,7 +34,7 @@
<button type="submit" class="btn btn-default btn-sm"><i class="fa fa-print"></i> {$_L['Click_Here_to_Print']}</button>
<a href="{$_url}prepaid/list" class="btn btn-primary"><i class="ion-reply-all"></i>{$_L['Finish']}</a>
</form>
</div>
</div>
</div>