Files
WrenchBoradWeb/www-api/app/Controllers/WrenchCrons.php
T
CHIEFSOFT\ameye 78c103b1f5 Added crons
2024-02-03 11:59:44 -05:00

153 lines
5.4 KiB
PHP

<?php
namespace App\Controllers;
define('WRB_CRONJOB_JOBDUE_REMINDER',771);
define('WRB_CRONJOB_JOBDUE_PAYMENTS',772);
define('WRB_CRONJOB_SIGNUP_ALERT', 773);
define('WRB_CRONJOB_PASTDUE_ALERT',774);
define('WRB_CRONJOB_OFFER_REFUND_ALERT',775);
define('WRB_CRONJOB_PENDOFFER_ALERT',776);
define('WRB_CRONJOB_NOTIFICATIONS', 777) ;
define('WRB_CRONJOB_GROUPJOBS', 778) ;
define('WRB_CRONJOB_PENDINGSM', 790) ;
class WrenchCrons extends BaseController
{
public function apigate(){
$in["action"] =WRB_JOB_CRONJOB;
$wrenchboard = new \App\Models\BackendModel();
$in['call_action'] = WRB_CRONJOB_SIGNUP_ALERT;
$in['one_limit'] = 3;
$ret['WRB_CRONJOB_SIGNUP_ALERT'] = $wrenchboard->wrenchboard_api($in, $out);
// $out['internal_return'] = $ret;
$out = $ret;
log_message('critical', "WrenchCrons ===> 0001");
//$response = []; //json_decode($complete, true);
return $this->response->setJson($out);
}
//$routes->get('/en/wrench/api/v1/cron', 'WrenchCrons::apigate');
//$routes->get('/en/wrench/api/v1/cron_jobalerts', 'WrenchCrons::jobalerts');
//$routes->get('/en/wrench/api/v1/cron_notifications', 'WrenchCrons::notifications');
public function groupoffer(){
log_message('critical', "WrenchCrons ===> groupoffer ******** 0001");
$in["action"] = WRB_JOB_CRONJOB;
$wrenchboard = new \App\Models\BackendModel();
$out=[];
$in['call_action'] = WRB_CRONJOB_GROUPJOBS;
$in['one_limit'] = 10; //remove this
$in['limit'] = 10;
$ret['WRB_CRONJOB_GROUPJOBS'] = $wrenchboard->wrenchboard_api($in, $out);
$out = $ret;
log_message('critical', "WrenchCrons Out ===> groupoffer ******** 0001");
//$response = []; //json_decode($complete, true);
return $this->response->setJson($out);
return [];
}
public function cron_notifications()
{
log_message('critical', "WrenchCrons ===> cron_notifications ******** 0001");
log_message('critical', "WrenchCrons ===> cron_notifications ******** 0001");
$in["action"] = WRB_JOB_CRONJOB;
$wrenchboard = new \App\Models\BackendModel();
$out=[];
$in['call_action'] = WRB_CRONJOB_NOTIFICATIONS;
$in['one_limit'] = 10; //remove this
$in['limit'] = 10;
$ret['WRB_CRONJOB_NOTIFICATIONS'] = $wrenchboard->wrenchboard_api($in, $out);
$out = $ret;
log_message('critical', "WrenchCrons Out ===> cron_notifications ******** 0001");
//$response = []; //json_decode($complete, true);
return $this->response->setJson($out);
}
public function jobalerts(){
$in["action"] =WRB_JOB_CRONJOB;
$wrenchboard = new \App\Models\BackendModel();
$in['call_action'] = WRB_CRONJOB_JOBDUE_REMINDER;
$in['one_limit'] = 3;
$ret['WRB_CRONJOB_JOBDUE_REMINDER'] = $wrenchboard->wrenchboard_api($in, $out);
//
// $in['call_action'] = WRB_CRONJOB_PENDOFFER_ALERT;
// $in['one_limit'] = 3;
// $ret['WRB_CRONJOB_PENDOFFER_ALERT'] = $wrenchboard->wrenchboard_api($in, $out);
$in['call_action'] = WRB_CRONJOB_JOBDUE_PAYMENTS;
$in['one_limit'] = 3;
$ret['WRB_CRONJOB_JOBDUE_PAYMENTS'] = $wrenchboard->wrenchboard_api($in, $out);
$in['call_action'] = WRB_CRONJOB_PASTDUE_ALERT;
$in['one_limit'] = 3;
$ret['WRB_CRONJOB_PASTDUE_ALERT'] = $wrenchboard->wrenchboard_api($in, $out);
$in['call_action'] = WRB_CRONJOB_OFFER_REFUND_ALERT;
$in['one_limit'] = 1;
$ret['WRB_CRONJOB_OFFER_REFUND_ALERT'] = $wrenchboard->wrenchboard_api($in, $out);
// $out['internal_return'] = $ret;
$out = $ret;
log_message('critical', "WrenchCrons ===> 0001");
//$response = []; //json_decode($complete, true);
return $this->response->setJson($out);
}
public function tranfercrons(){
$out = array();
log_message('critical', "WrenchCrons ===> tranfercrons ******** 0001");
$in["action"] =WRB_JOB_CRONJOB;
$wrenchboard = new \App\Models\BackendModel();
$in['call_action'] = WRB_CRONJOB_PENDINGSM;
$in['one_limit'] = 10;
$in['mode'] = 100;
$ret['WRB_CRONJOB_PENDINGSM'] = $wrenchboard->wrenchboard_api($in, $out);
return $this->response->setJson($out);
}
public function offersreminders(){
log_message('critical', "WrenchCrons ===> offersreminders ******** 0001");
$in["action"] =WRB_JOB_CRONJOB;
$wrenchboard = new \App\Models\BackendModel();
$in['call_action'] = WRB_CRONJOB_PENDOFFER_ALERT;
$in['one_limit'] = 10;
$in['mode'] = 100;
$ret['WRB_CRONJOB_PENDOFFER_ALERT_100'] = $wrenchboard->wrenchboard_api($in, $out);
$in['call_action'] = WRB_CRONJOB_PENDOFFER_ALERT;
$in['one_limit'] = 10;
$in['mode'] = 200; // 12 hours before expritation
$ret['WRB_CRONJOB_PENDOFFER_ALERT_200'] = $wrenchboard->wrenchboard_api($in, $out);
$in['call_action'] = WRB_CRONJOB_PENDOFFER_ALERT;
$in['one_limit'] = 10;
$in['mode'] = 300; // 6h hours before expritation
$ret['WRB_CRONJOB_PENDOFFER_ALERT_300'] = $wrenchboard->wrenchboard_api($in, $out);
// $out['internal_return'] = $ret;
$out = $ret;
log_message('critical', "WrenchCrons ===> 0001");
//$response = []; //json_decode($complete, true);
return $this->response->setJson($out);
}
}