This commit is contained in:
CHIEFSOFT\ameye
2024-09-23 07:32:19 -04:00
parent fed49366a5
commit 60173437db
+31
View File
@@ -159,6 +159,7 @@ long ProcessExpiredOffers(CVars in, CVars &out){
char vname[30];
long ret = PHP_API_BAD_PARAM;
try {
// First stage ; JUST MARK FOR AUTO AND COME BACK
out["total_record"] = "0";
const PGresult *res;
res = pgsql_query("SELECT status,member_id, id AS offer_id, uid,offer_code FROM members_jobs_offer "
@@ -180,6 +181,32 @@ long ProcessExpiredOffers(CVars in, CVars &out){
" WHERE id = %lu AND uid::text = '%s' ", rec["offer_id"].Long(),rec["uid"].c_str()); // move the status so no retry
}
}
//SELECT status,member_id, id, uid,offer_code FROM members_jobs_offer WHERE expire< now() AND status = 1 AND refund_auto < (now() - interval '15 minutes') AND refund_status =0 AND payment_id IS NOT NULL ORDER BY id ASC LIMIT 10
res = pgsql_query("SELECT status,member_id, id, uid,offer_code "
" FROM members_jobs_offer "
" WHERE expire< now() AND status = 1 "
" AND refund_auto < (now() - interval '15 minutes') "
" AND refund_status =0 "
" AND payment_id IS NOT NULL "
" ORDER BY id ASC LIMIT 10");
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);
pgsql_query("UPDATE members_jobs_offer SET refund_status= 2 "
" WHERE id = %lu AND uid::text = '%s' ", rec["offer_id"].Long(),rec["uid"].c_str()); // move the status so no retry
}
}
ret = PHP_API_OK;
out["status"] = "OK";
} catch (bad_parameter) {
@@ -189,6 +216,10 @@ long ProcessExpiredOffers(CVars in, CVars &out){
//case WRENCHBOARD_JOB_OFFER_CONCLUDE:
//return WrenchConcludeJobsOffer(in, out);
//break;