Files
WrenchBoradWeb/www-api/app/Controllers/AirFlow.php
T
CHIEFSOFT\ameye a599c64a67 space
2024-09-01 20:43:55 -04:00

120 lines
4.2 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 AirFlow extends BaseController
{
public function flowNewAccount(){
$raw_json = file_get_contents('php://input');
$in = json_decode($raw_json, true);
$out =[];
log_message('critical', "AirFlow::flowNewAccount ********* ALL ".serialize($in) );
return []; //json_encode( $final_out );
}
public function flowOfferPending(){
$raw_json = file_get_contents('php://input');
$in = json_decode($raw_json, true);
$out =[];
log_message('critical', "AirFlow::flowOfferPending ********* ALL ".serialize($in) );
return []; //json_encode( $final_out );
}
public function flowDueReminder(){
$raw_json = file_get_contents('php://input');
$in = json_decode($raw_json, true);
$out =[];
return $this->jobLevelAlerts();
log_message('critical', "AirFlow::flowDueReminder ********* ALL ".serialize($in) );
return []; //json_encode( $final_out );
}
public function flowApproveReminder(){
$raw_json = file_get_contents('php://input');
$in = json_decode($raw_json, true);
$out =[];
log_message('critical', "AirFlow::flowApproveReminder ********* ALL ".serialize($in) );
return []; //json_encode( $final_out );
}
public function flowSignupReport(){
$raw_json = file_get_contents('php://input');
$in = json_decode($raw_json, true);
$out =[];
$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);
$ret['WRB_CRONJOB_SIGNUP_ALERT'] = (new \App\Models\BackendModel())->wrenchboard_api($in, $out);
// $out['internal_return'] = $ret;
$out = $ret;
log_message('critical', "AirFlow::flowSignupReport ********* ALL ".serialize($in) );
return []; //json_encode( $final_out );
}
public function flowRefreshBlog(){
$raw_json = file_get_contents('php://input');
$in = json_decode($raw_json, true);
$out =[];
$endpoint = "WRENCH_BLOG_DATA";
$res1 = $this->getCache($endpoint);
if (count($res1)==0){
$rawData = $this->apiData(0);
$res1= $rawData['payload']; //[0]['payload'];
$this->saveCache($endpoint,$res1);
}
log_message('critical', "AirFlow::flowRefreshBlog ********* ALL ".serialize($in) );
return []; //json_encode( $final_out );
}
private function jobLevelAlerts(){
$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);
}
}