offers remiinders

This commit is contained in:
CHIEFSOFT\ameye
2023-12-06 19:48:45 -05:00
parent 22f1e74bde
commit a32a24369c
2 changed files with 35 additions and 6 deletions
+19 -4
View File
@@ -129,15 +129,30 @@ long ReviewReminder(CVars in, CVars &out) {
}
long OfferPending(CVars in, CVars &out) {
logfmt(logINFO, "ENTER OfferPending()");
logfmt(logINFO, "ENTER OfferPending()");
long limit = in["one_limit"].Long();
long mode = REQ_LONG(in, "mode", 0, -1);
char extraQ[600];
if ( mode == 100 ){
snprintf(extraQ, sizeof (extraQ), " WHERE now() > jo.added +'6 hrs' AND jo.expire > now() AND jo.status = 1 AND jo.public_view =0 AND jo.reminder_count =0 AND jo.reminder_date IS NULL");
}
if ( mode == 200 ){
snprintf(extraQ, sizeof (extraQ), " WHERE jo.expire < now() +'12 hrs' AND jo.expire > now() AND jo.status = 1 AND jo.public_view =0 AND jo.reminder_count = 1 AND jo.reminder_date IS NOT NULL");
}
if ( mode == 100 ){
snprintf(extraQ, sizeof (extraQ), " WHERE jo.expire < now() +'6 hrs' AND jo.expire > now() AND jo.status = 1 AND jo.public_view =0 AND jo.reminder_count > 0 AND jo.reminder_date IS NOT NULL");
}
const PGresult *res = pgsql_query("SELECT jo.id AS offer_id,jo.added,j.title,jo.expire,jo.email, jo.client_id, "
"jo.job_id,jo.reminder_count,jo.reminder_date "
"FROM members_jobs_offer jo "
"LEFT JOIN members_jobs j ON j.id = jo.job_id "
"WHERE now() > jo.added +'6 hrs' "
"AND jo.expire > now() AND jo.status = 1 AND jo.public_view =0 "
"AND jo.reminder_count =0 AND jo.reminder_date IS NULL LIMIT %lu ",limit);
" %s LIMIT %lu ",extraQ, limit);
if (res != NULL && pgsql_num_rows(res) > 0) {
for (int i = 0, n = pgsql_num_rows(res); i < n; i++) {
+16 -2
View File
@@ -82,8 +82,22 @@ class WrenchCrons extends BaseController
$wrenchboard = new \App\Models\BackendModel();
$in['call_action'] = WRB_CRONJOB_PENDOFFER_ALERT;
$in['one_limit'] = 3;
$ret['WRB_CRONJOB_PENDOFFER_ALERT'] = $wrenchboard->wrenchboard_api($in, $out);
$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;