This commit is contained in:
CHIEFSOFT\ameye
2023-05-19 16:43:20 -04:00
parent 8cac594685
commit 3554c3dfe8
+40
View File
@@ -133,11 +133,51 @@ long jobs_calls(CVars in, CVars &out) {
}
long WrenchJobPostExtendTime(CVars in, CVars &out){
long ret = PHP_API_BAD_PARAM;
try {
out["status"] = "Started";
long member_id = REQ_LONG(in, "member_id", 1, -1);
long extend_days = REQ_LONG(in, "extend_days", 1, -1);
REQ_STRING(in, "job_uid", 1, 35, "(.*)"); //offer_code
REQ_STRING(in, "offer_code", 1, 15, "(.*)"); //offer_code
const PGresult *res = pgsql_query("SELECT id AS offer_id FROM members_jobs_offer WHERE offer_code = '%s' AND member_id=%lu AND status =1", in["offer_code"].c_str(),member_id);
if (res != NULL && pgsql_num_rows(res) > 0) {
map<const char*, const char*>f = pgsql_fetch_assoc(res, 0);
if (!f.empty()) {
CVars rec;
map_to_cvars(f, rec);
pgsql_query("UPDATE members_jobs_offer SET expire = now() + '%lu days()' WHERE offer_code = '%s' AND member_id=%lu AND status =1",rec["offer_id"].Long(), in["offer_code"].c_str(),member_id);
ret = PHP_UPDATED_OK;
}
}
} catch (bad_parameter) {
out["log_status"] = "error...";
}
return ret;
}
long WrenchJobPostNotifyOffer(CVars in, CVars &out){
long ret = PHP_API_BAD_PARAM;
try {
out["status"] = "Started";
long member_id = REQ_LONG(in, "member_id", 1, -1);
long mode = REQ_LONG(in, "mode", 1, -1);
REQ_STRING(in, "job_uid", 1, 35, "(.*)"); //offer_code
REQ_STRING(in, "offer_code", 1, 15, "(.*)"); //offer_code
const PGresult *res = pgsql_query("SELECT id AS offer_id FROM members_jobs_offer WHERE offer_code = '%s' AND member_id=%lu AND status =1", in["offer_code"].c_str(),member_id);
if (res != NULL && pgsql_num_rows(res) > 0) {
map<const char*, const char*>f = pgsql_fetch_assoc(res, 0);
if (!f.empty()) {
logfmt(logINFO, "******* ~~~~ WrenchJobPostNotifyOffer()");
ret = PHP_UPDATED_OK;
}
}
} catch (bad_parameter) {
out["log_status"] = "error...";
}
return ret;
}
long WrenchJobPostCancelOffer(CVars in, CVars &out){