From b864050363ac682588893f903bbba884216433a5 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Mon, 23 Sep 2024 08:32:27 -0400 Subject: [PATCH] offer_id --- wrenchboard/src/shared_tool/site_crons.cc | 36 ++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/wrenchboard/src/shared_tool/site_crons.cc b/wrenchboard/src/shared_tool/site_crons.cc index 19abd4bb..22c50ac7 100644 --- a/wrenchboard/src/shared_tool/site_crons.cc +++ b/wrenchboard/src/shared_tool/site_crons.cc @@ -157,6 +157,8 @@ long sitecrons_calls(CVars in, CVars &out) { long ProcessExpiredOffers(CVars in, CVars &out){ char vname[30]; + CVars inR; + CVars outR; long ret = PHP_API_BAD_PARAM; try { // First stage ; JUST MARK FOR AUTO AND COME BACK @@ -182,9 +184,41 @@ long ProcessExpiredOffers(CVars in, CVars &out){ } } + // STATUS = 2 Now start refund + res = pgsql_query("SELECT status,member_id, id AS offer_id, uid,offer_code " + " FROM members_jobs_offer " + " WHERE expire< now() AND status = 1 " + " AND refund_auto < (now() - interval '15 minutes') " + " AND refund_status = 2 " + " 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++) { + mapf = 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 +/* + inR['offer_code'] = $out[0]['offer_code']; // + inR['member_id'] = $out[0]['member_id']; + inR['offer_result'] = OFFER_EXPIRE; + inR['action'] = WRENCHBOARD_JOB_OFFER_CONCLUDE; + + + //case WRENCHBOARD_JOB_OFFER_CONCLUDE: + WrenchConcludeJobsOffer(inR, outR); + */ + } + } + //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 " + res = pgsql_query("SELECT status,member_id, id AS offer_id, uid,offer_code " " FROM members_jobs_offer " " WHERE expire< now() AND status = 1 " " AND refund_auto < (now() - interval '15 minutes') "