add hook when recharge

This commit is contained in:
Ibnu Maksum 2024-03-01 09:57:59 +07:00
parent 699289662b
commit de3312055a
No known key found for this signature in database
GPG key ID: 7FC82848810579E5
3 changed files with 10 additions and 5 deletions

View file

@ -238,7 +238,7 @@ function r2($to, $ntype = 'e', $msg = '')
exit; exit;
} }
function _alert($text, $type = 'success', $url = "home") function _alert($text, $type = 'success', $url = "home", $time = 3)
{ {
global $ui; global $ui;
if (!isset($ui)) return; if (!isset($ui)) return;
@ -251,8 +251,10 @@ function _alert($text, $type = 'success', $url = "home")
} }
$ui->assign('text', $text); $ui->assign('text', $text);
$ui->assign('type', $type); $ui->assign('type', $type);
$ui->assign('time', $time);
$ui->assign('url', $url); $ui->assign('url', $url);
$ui->display('alert.tpl'); $ui->display('alert.tpl');
die();
} }

View file

@ -94,6 +94,9 @@ class Package
->where('Type', $p['type']) ->where('Type', $p['type'])
->find_one(); ->find_one();
run_hook("recharge_user");
$mikrotik = Mikrotik::info($router_name); $mikrotik = Mikrotik::info($router_name);
if ($p['validity_unit'] == 'Months') { if ($p['validity_unit'] == 'Months') {
$date_exp = date("Y-m-d", strtotime('+' . $p['validity'] . ' month')); $date_exp = date("Y-m-d", strtotime('+' . $p['validity'] . ' month'));
@ -357,8 +360,8 @@ class Package
"\nChannel: " . $channel . "\nChannel: " . $channel .
"\nPrice: " . Lang::moneyFormat($p['price'])); "\nPrice: " . Lang::moneyFormat($p['price']));
} }
Message::sendInvoice($c, $t); Message::sendInvoice($c, $t);
run_hook("recharge_user_finish");
return true; return true;
} }

View file

@ -9,7 +9,7 @@
<link rel="shortcut icon" href="ui/ui/images/logo.png" type="image/x-icon" /> <link rel="shortcut icon" href="ui/ui/images/logo.png" type="image/x-icon" />
<link rel="stylesheet" href="ui/ui/styles/bootstrap.min.css"> <link rel="stylesheet" href="ui/ui/styles/bootstrap.min.css">
<link rel="stylesheet" href="ui/ui/styles/modern-AdminLTE.min.css"> <link rel="stylesheet" href="ui/ui/styles/modern-AdminLTE.min.css">
<meta http-equiv="refresh" content="3; url={$url}"> <meta http-equiv="refresh" content="{$time}; url={$url}">
</head> </head>
<body class="hold-transition lockscreen"> <body class="hold-transition lockscreen">
@ -20,7 +20,7 @@
{$text} {$text}
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
<a href="{$url}" id="button" class="btn btn-{$type} btn-block btn-block">{Lang::T('Click Here')} (3)</a> <a href="{$url}" id="button" class="btn btn-{$type} btn-block btn-block">{Lang::T('Click Here')} ({$time})</a>
</div> </div>
</div> </div>
<div class="lockscreen-footer text-center"> <div class="lockscreen-footer text-center">
@ -29,7 +29,7 @@
</div> </div>
<script> <script>
var time = 3; var time = {$time};
timer(); timer();
function timer() { function timer() {