promo monitor emsil

This commit is contained in:
CHIEFSOFT\ameye
2024-11-23 10:15:21 -05:00
parent 73dedf0513
commit 9b066a554b
3 changed files with 45 additions and 0 deletions
+1
View File
@@ -44,6 +44,7 @@ long market_email(long mailtype, CVars in, CVars &out);
long plan_notification(CVars in, CVars &out);
long SignupPendingAlertMailfile(CVars in);
long SignupCompletedAlertMailfile(CVars in);
long promo_email(long mailtype, CVars in, CVars &out);
#endif
+27
View File
@@ -66,6 +66,33 @@ CREATE TABLE members_notification (
return ret;
}
long promo_email(long mailtype, CVars in, CVars &out){
logfmt(logINFO, "alert_email()");
CVars x, y, z;
C_CGI_Form form("", "");
out["alertemail"] = CfgReadChar("transnotif.contact");
out["signupreport"] = CfgReadChar("transnotif.signupreport");
CVars yr;
load_db_record(yr, "SELECT to_char(now(), 'yyyy') AS YYYY");
vars2form(yr, form);
char * server_name = getenv("SERVER_NAME");
form.LetStr("server_name", server_name);
form.LetStr("site_name", "WrenchBoard");
form.LetStr("site_trade_name", "Connecting Opportunities");
switch (mailtype) {
case WRB_CRONJOB_PROCESS_PROMO:
vars2form(in, form);
form.LetStr("email", out["email"]);
form.Email("PROMO/promo_alert.mailfile");
break;
}
return 0;
}
long alert_email(long mailtype, CVars in, CVars &out) {
logfmt(logINFO, "alert_email()");
+17
View File
@@ -212,6 +212,23 @@ long RefreshPromoActivities(CVars in, CVars &out){
}
}
res = pgsql_query("SELECT * FROM promo_admin WHERE status = 1 ORDER BY updated ASC LIMIT 20");
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);
promo_email(WRB_CRONJOB_PROCESS_PROMO, rec, out); // send the reminder email
pgsql_query("UPDATE promo_admin SET updated = now() WHERE id = %lu ", rec["id"].Long()); // mo
}
}
ret = PHP_API_OK;
out["status"] = "OK";
} catch (bad_parameter) {