add Income reset date

This commit is contained in:
Ibnu Maksum 2024-06-20 14:57:19 +07:00
parent 28ec7883e2
commit 628fcda360
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
4 changed files with 19 additions and 10 deletions

View File

@ -24,7 +24,6 @@ $reset_day = $config['reset_day'];
if(empty($reset_day)){ if(empty($reset_day)){
$reset_day = 1; $reset_day = 1;
} }
$reset_day = 20;
//first day of month //first day of month
if($reset_day >= date("d")){ if($reset_day >= date("d")){
$first_day_month = date('Y-m-'.$reset_day); $first_day_month = date('Y-m-'.$reset_day);

View File

@ -19,33 +19,33 @@ switch ($action) {
case 'sync': case 'sync':
set_time_limit(-1); set_time_limit(-1);
if ($routes['2'] == 'hotspot') { if ($routes['2'] == 'hotspot') {
$plans = ORM::for_table('tbl_bandwidth')->left_outer_join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'Hotspot')->where('tbl_plans.enabled', '1')->find_many(); $plans = ORM::for_table('tbl_plans')->where('type', 'Hotspot')->find_many();
$log = ''; $log = '';
$router = '';
foreach ($plans as $plan) { foreach ($plans as $plan) {
$dvc = Package::getDevice($plan); $dvc = Package::getDevice($plan);
if ($_app_stage != 'demo') { if ($_app_stage != 'demo') {
if (file_exists($dvc)) { if (file_exists($dvc)) {
require_once $dvc; require_once $dvc;
(new $p['device'])->add_plan($plan); (new $plan['device'])->add_plan($plan);
$log .= "DONE : $plan[name_plan], $plan[device]<br>";
} else { } else {
new Exception(Lang::T("Devices Not Found")); $log .= "FAILED : $plan[name_plan], $plan[device] | Device Not Found<br>";
} }
} }
} }
r2(U . 'services/hotspot', 's', $log); r2(U . 'services/hotspot', 's', $log);
} else if ($routes['2'] == 'pppoe') { } else if ($routes['2'] == 'pppoe') {
$plans = ORM::for_table('tbl_bandwidth')->left_outer_join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'PPPOE')->where('tbl_plans.enabled', '1')->find_many(); $plans = ORM::for_table('tbl_plans')->where('type', 'PPPOE')->find_many();
$log = ''; $log = '';
$router = '';
foreach ($plans as $plan) { foreach ($plans as $plan) {
$dvc = Package::getDevice($plan); $dvc = Package::getDevice($plan);
if ($_app_stage != 'demo') { if ($_app_stage != 'demo') {
if (file_exists($dvc)) { if (file_exists($dvc)) {
require_once $dvc; require_once $dvc;
(new $p['device'])->add_plan($plan); (new $plan['device'])->add_plan($plan);
$log .= "DONE : $plan[name_plan], $plan[device]<br>";
} else { } else {
new Exception(Lang::T("Devices Not Found")); $log .= "FAILED : $plan[name_plan], $plan[device] | Device Not Found<br>";
} }
} }
} }

View File

@ -645,5 +645,6 @@
"later": "later", "later": "later",
"Package_Details": "Package Details", "Package_Details": "Package Details",
"Summary": "Summary", "Summary": "Summary",
"Devices_Not_Found": "Devices Not Found" "Devices_Not_Found": "Devices Not Found",
"Income_reset_date": "Income reset date"
} }

View File

@ -96,6 +96,15 @@
<p class="help-block col-md-4">This used for admin to select payment in recharge, using comma <p class="help-block col-md-4">This used for admin to select payment in recharge, using comma
for every new options</p> for every new options</p>
</div> </div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Income reset date')}</label>
<div class="col-md-6">
<input type="number" required class="form-control" id="reset_day" placeholder="20" min="1"
max="28" step="1" name="reset_day" value="{$_c['reset_day']}">
</div>
<span class="help-block col-md-4">Income will reset every this day</span>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">APP URL</label> <label class="col-md-2 control-label">APP URL</label>
<div class="col-md-6"> <div class="col-md-6">