new cron jons

This commit is contained in:
CHIEFSOFT\ameye
2024-09-09 16:47:24 -04:00
parent 4089b3dd6a
commit 74cf9f43bf
3 changed files with 82 additions and 6 deletions
@@ -162,6 +162,10 @@ enum { PARTNER_STRIPE };
#define WRB_CRONJOB_NOTIFICATIONS 777
#define WRB_CRONJOB_GROUPJOBS 778
#define WRB_CRONJOB_TESTNOTIFICATIONS 779
#define WRB_CRONJOB_SCHEULETRANSFER 780
#define WRB_CRONJOB_PROCESSTRANSFER 781
#define WRB_CRONJOB_PENDINGSM 790
//**************************************************************
+56 -4
View File
@@ -28,6 +28,9 @@ long CronTracker(CVars in, CVars &out);
long SendMoneyPending(CVars in, CVars &out);
long ProcessGroupJobs(CVars in, CVars &out);
long ProcessTransferJobs(CVars in, CVars &out);
long ScheduleTransferJobs(CVars in, CVars &out);
long TestNotificationsJobs(CVars in, CVars &out);
/*
CREATE TABLE cron_jobs (
id SERIAL,
@@ -109,10 +112,31 @@ long sitecrons_calls(CVars in, CVars &out) {
break;
case WRB_CRONJOB_GROUPJOBS:
ct["job_type"]="WRB_CRONJOB_GROUPJOBS"; ct["job_type"].set_valid( true );
ct["description"]="Job Group Processing"; ct["description"].set_valid( true );
CronTracker(ct, co);
return ProcessGroupJobs(in, out);
ct["job_type"]="WRB_CRONJOB_GROUPJOBS"; ct["job_type"].set_valid( true );
ct["description"]="Job Group Processing"; ct["description"].set_valid( true );
CronTracker(ct, co);
return ProcessGroupJobs(in, out);
break;
case WRB_CRONJOB_TESTNOTIFICATIONS:
ct["job_type"]="WRB_CRONJOB_TESTNOTIFICATIONS"; ct["job_type"].set_valid( true );
ct["description"]="Test Notifications Processing"; ct["description"].set_valid( true );
CronTracker(ct, co);
return TestNotificationsJobs(in, out);
break;
case WRB_CRONJOB_SCHEULETRANSFER:
ct["job_type"]="WRB_CRONJOB_SCHEULETRANSFER"; ct["job_type"].set_valid( true );
ct["description"]="Schedule Transfer Processing"; ct["description"].set_valid( true );
CronTracker(ct, co);
return ScheduleTransferJobs(in, out);
break;
case WRB_CRONJOB_PROCESSTRANSFER:
ct["job_type"]="WRB_CRONJOB_PROCESSTRANSFER"; ct["job_type"].set_valid( true );
ct["description"]="Process Transfer Processing"; ct["description"].set_valid( true );
CronTracker(ct, co);
return ProcessTransferJobs(in, out);
break;
}
@@ -121,6 +145,34 @@ long sitecrons_calls(CVars in, CVars &out) {
return ret;
}
long ProcessTransferJobs(CVars in, CVars &out){
// if ( load_db_record(out, "SELECT count(uid) AS pending_count FROM money_transfer WHERE status =1 AND completed IS NULL ")> 0){
// if ( out["pending_count"].Long() > 0 ){
// alert_email(WRB_CRONJOB_PENDINGSM,out, out);
// }
// }
return 0;
}
long ScheduleTransferJobs(CVars in, CVars &out){
// if ( load_db_record(out, "SELECT initiatingamount, status, added,proc FROM money_transfer WHERE added > (now() - interval '3000 minutes') AND status = 0 ORDER BY id DESC LIMIT 100 ")> 0){
// if ( out["pending_count"].Long() > 0 ){
// alert_email(WRB_CRONJOB_PENDINGSM,out, out);
// }
// }
return 0;
}
long TestNotificationsJobs(CVars in, CVars &out){
// if ( load_db_record(out, "SELECT count(uid) AS pending_count FROM money_transfer WHERE status =1 AND completed IS NULL ")> 0){
// if ( out["pending_count"].Long() > 0 ){
// alert_email(WRB_CRONJOB_PENDINGSM,out, out);
// }
// }
return 0;
}
long SendMoneyPending(CVars in, CVars &out){
if ( load_db_record(out, "SELECT count(uid) AS pending_count FROM money_transfer WHERE status =1 AND completed IS NULL ")> 0){
if ( out["pending_count"].Long() > 0 ){
+22 -2
View File
@@ -9,7 +9,11 @@ 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_GROUPJOBS', 778);
define('WRB_CRONJOB_TESTNOTIFICATIONS', 779);
define('WRB_CRONJOB_SCHEULETRANSFER', 780);
define('WRB_CRONJOB_PROCESSTRANSFER', 781);
define('WRB_CRONJOB_PENDINGSM', 790) ;
class AirFlow extends BaseController
@@ -76,6 +80,11 @@ class AirFlow extends BaseController
$in = json_decode($raw_json, true);
$out =[];
log_message('critical', "AirFlow::flowProcessTransfer ********* ALL ".serialize($in) );
$in["loc"] = $_SERVER["REMOTE_ADDR"];
$in['call_action'] = WRB_CRONJOB_PROCESSTRANSFER;
$in['one_limit'] = 10; //remove this
$in['limit'] = 10;
$ret['WRB_CRONJOB_PROCESSTRANSFER'] = (new \App\Models\BackendModel())->wrenchboard_api($in, $out);
return []; //json_encode( $final_out );
}
@@ -84,16 +93,27 @@ class AirFlow extends BaseController
$raw_json = file_get_contents('php://input');
$in = json_decode($raw_json, true);
$out =[];
// ALTER TABLE money_transfer ADD proc INT DEFAULT 0;
// SELECT initiatingamount, status, added,proc FROM money_transfer WHERE added > (now() - interval '3000 minutes') AND status = 0 ORDER BY id DESC LIMIT 100;
log_message('critical', "AirFlow::flowScheduleTransfer ********* ALL ".serialize($in) );
$in["loc"] = $_SERVER["REMOTE_ADDR"];
$in['call_action'] = WRB_CRONJOB_SCHEULETRANSFER;
$in['one_limit'] = 10; //remove this
$in['limit'] = 10;
$ret['WRB_CRONJOB_SCHEULETRANSFER'] = (new \App\Models\BackendModel())->wrenchboard_api($in, $out);
return []; //json_encode( $final_out );
}
public function flowTestNotifications(){
$raw_json = file_get_contents('php://input');
$in = json_decode($raw_json, true);
$out =[];
log_message('critical', "AirFlow::flowTestNotifications ********* ALL ".serialize($in) );
$in["loc"] = $_SERVER["REMOTE_ADDR"];
$in['call_action'] = WRB_CRONJOB_TESTNOTIFICATIONS;
$in['one_limit'] = 10; //remove this
$in['limit'] = 10;
$ret['WRB_CRONJOB_TESTNOTIFICATIONS'] = (new \App\Models\BackendModel())->wrenchboard_api($in, $out);
return []; //json_encode( $final_out );
}