This commit is contained in:
2022-05-12 22:40:49 -04:00
parent 40a92d844a
commit ecbd702ec5
2 changed files with 34 additions and 1 deletions
+1 -1
View File
@@ -113,7 +113,7 @@ enum { PARTNER_STRIPE };
#define WRB_CRONJOB_SIGNUP_ALERT 773
#define WRB_CRONJOB_PASTDUE_ALERT 774
#define WRB_CRONJOB_OFFER_REFUND_ALERT 775
//**************************************************************
#define WRENCHBOARD_BKO_START 10000
+33
View File
@@ -21,6 +21,7 @@ long DeadlineLineApprachClient(CVars in, CVars &out);
long SignUpPendingReminder(CVars in, CVars &out);
long SignUpStats(CVars in, CVars &out);
long PastDueWarings(CVars in, CVars &out);
long PastDueOffersRefund(CVars in, CVars &out);
long sitecrons_calls(CVars in, CVars &out) {
logfmt(logINFO, "sitecrons_calls()");
@@ -47,6 +48,9 @@ long sitecrons_calls(CVars in, CVars &out) {
return PastDueWarings(in, out);
break;
case WRB_CRONJOB_OFFER_REFUND_ALERT:
return PastDueOffersRefund(in, out);
break;
}
@@ -70,6 +74,35 @@ long InterestPending(CVars in, CVars &out) {
}
long PastDueOffersRefund(CVars in, CVars &out) {
logfmt(logINFO, "ENTER PastDueOffersRefund()");
long contract_id = 0;
const PGresult *res = pgsql_query("SELECT j.* "
" FROM members_jobs_offer j "
" LEFT JOIN members m1 ON m1.id=j.member_id "
" LEFT JOIN members m2 ON m2.id=j.client_id "
" WHERE j.expire < now() "
" AND j.status = 1 AND j.auto_close IS NULL "
" AND j.payment_id IS NOT NULL LIMIT 1");
if (res != NULL && pgsql_num_rows(res) > 0) {
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);
rec["offer_result"] = OFFER_EXPIRE;
rec["offer_result"].set_valid( true );
WrenchConcludeJobsOffer(rec, out);
pgsql_exec("UPDATE members_jobs_offer SET auto_close=now() "\
"WHERE offer_code='%s' ", rec["offer_code"].c_str());
}
}
logfmt(logINFO, "/PastDueOffersRefund()");
return 0;
}
long PastDueWarings(CVars in, CVars &out) {