promotion
This commit is contained in:
@@ -290,9 +290,12 @@ long cron_email(long mailtype, CVars in, CVars &out) {
|
||||
form.Email("REMINDER/offer_pending_reminder.mailfile");
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
case WRB_CRONJOB_HOLIDAY_BROADCAST:
|
||||
vars2form(x, form); // need to remove
|
||||
vars2form(in, form);
|
||||
form.LetStr("email", in["email"].c_str());
|
||||
form.Email("HOLIDAY/independence_ng_2025.mailfile");
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (bad_parameter) {
|
||||
|
||||
@@ -32,6 +32,7 @@ long ProcessTransferJobs(CVars in, CVars &out);
|
||||
long ScheduleTransferJobs(CVars in, CVars &out);
|
||||
long TestNotificationsJobs(CVars in, CVars &out);
|
||||
long ProcessExpiredOffers(CVars in, CVars &out);
|
||||
long ScheduleHolidayJobs(CVars in, CVars &out);
|
||||
|
||||
/*
|
||||
CREATE TABLE cron_jobs (
|
||||
@@ -147,14 +148,45 @@ long sitecrons_calls(CVars in, CVars &out) {
|
||||
CronTracker(ct, co);
|
||||
return ProcessExpiredOffers(in, out);
|
||||
break;
|
||||
|
||||
|
||||
//define('WRB_CRONJOB_HOLIDAY_BROADCAST', 786);
|
||||
case WRB_CRONJOB_HOLIDAY_BROADCAST:
|
||||
return ScheduleHolidayJobs(in, out);
|
||||
break;
|
||||
}
|
||||
|
||||
logfmt(logINFO, "/sitecrons_calls()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
long ScheduleHolidayJobs(CVars in, CVars &out){
|
||||
char vname[30];
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
try {
|
||||
out["total_record"] = "0";
|
||||
const PGresult *res;
|
||||
res = pgsql_query("SELECT * FROM holiday_message WHERE status = 1 AND completed IS NULL ORDER BY id DESC LIMIT 5");
|
||||
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
out["total_record"] = pgsql_num_rows(res);
|
||||
|
||||
for (int i = 0, n = pgsql_num_rows(res); i < n; i++) {
|
||||
map<const char*, const char*>f = pgsql_fetch_assoc(res, i);
|
||||
if (f.empty()) continue;
|
||||
CVars rec;
|
||||
map_to_cvars(f, rec);
|
||||
cron_email(WRB_CRONJOB_HOLIDAY_BROADCAST, rec, out); // send the cron email
|
||||
pgsql_query("UPDATE holiday_message SET status = 5, completed = now() WHERE id = %lu ", rec["id"].Long()); // move the status so no retry
|
||||
}
|
||||
}
|
||||
ret = PHP_API_OK;
|
||||
out["status"] = "OK";
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long ScheduleHolidayJobs(CVars in, CVars &out)");
|
||||
}
|
||||
logfmt(logINFO, "/ScheduleHolidayJobs()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
long ProcessExpiredOffers(CVars in, CVars &out){
|
||||
char vname[30];
|
||||
CVars inR;
|
||||
|
||||
Reference in New Issue
Block a user