check expired payments

This commit is contained in:
iBNu Maksum 2024-10-17 09:44:21 +07:00
parent b15fdf1d6a
commit 0cf5483353
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5

View File

@ -326,10 +326,24 @@ $vpn = ORM::for_table('tbl_port_pool')
$ui->assign('cf', $tcf); $ui->assign('cf', $tcf);
$ui->assign('vpn', $vpn); $ui->assign('vpn', $vpn);
$ui->assign('unpaid', ORM::for_table('tbl_payment_gateway') $unpaids = [];
$unpaid = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username']) ->where('username', $user['username'])
->where('status', 1) ->where('status', 1)
->find_one()); ->find_one();
// check expired payments
foreach($unpaid as $up) {
if(strtotime($up['expired_date']) < time() || strtotime($up['created_date'], "+24 HOUR") < time()){
$up->status = 4;
$up->save();
}else{
$unpaids[] = $up;
}
}
$ui->assign('unpaid', $unpaids);
$ui->assign('code', alphanumeric(_get('code'), "-")); $ui->assign('code', alphanumeric(_get('code'), "-"));
$abills = User::getAttributes("Bill"); $abills = User::getAttributes("Bill");