diff --git a/wrenchboard/src/shared_tool/site_crons.cc b/wrenchboard/src/shared_tool/site_crons.cc index bbe5fb38..0737e4cd 100644 --- a/wrenchboard/src/shared_tool/site_crons.cc +++ b/wrenchboard/src/shared_tool/site_crons.cc @@ -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++) { diff --git a/www-api/app/Controllers/WrenchCrons.php b/www-api/app/Controllers/WrenchCrons.php index 778079ba..e73f75d7 100644 --- a/www-api/app/Controllers/WrenchCrons.php +++ b/www-api/app/Controllers/WrenchCrons.php @@ -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;