diff --git a/wrenchboard/src/shared_tool/jobs.cc b/wrenchboard/src/shared_tool/jobs.cc index 0ffc9268..f325d9ea 100644 --- a/wrenchboard/src/shared_tool/jobs.cc +++ b/wrenchboard/src/shared_tool/jobs.cc @@ -508,7 +508,34 @@ long WrenchJobsQuestion(CVars in, CVars &out) { status | integer | default 1 senders_id | integer | Indexes: - "members_messages_id_key" + "members_messages_id_key" + + + action + : + 13034 + client_uid + : + "43c766d9-403d-4125-9983-63c21960b187" + member_id + : + "1" + offer_code + : + "XWT8B7W377" + offer_uid + : + "10088dc3-c1ed-4782-808c-ae64940d3405" + proc + : + "ACCEPT" + sessionid + : + "800EDEE8AECA96EDAE0380537F5DE4546032B0709CD8FDA1BBAF5CAC0BF2ED1E" + uid + : + "3119b744-42ad-4834-bb83-b737588754ca" + */ long WrenchJobsProcessInterest(CVars in, CVars &out) { @@ -516,12 +543,35 @@ long WrenchJobsProcessInterest(CVars in, CVars &out) { out = in; out["status"] = "Recieved"; REQ_LONG(in, "member_id", 1, -1); + REQ_STRING(in, "client_uid", 1, 55, "(.*)"); //client_uid + REQ_STRING(in, "offer_uid", 1, 55, "(.*)"); //client_uid + + const PGresult *res0 = pgsql_query("SELECT mo.id AS interest_id, mo.*,mm.uid,jo.uid " + " FROM members_offer_interest mo " + " LEFT JOIN members mm ON mm.id= mo.member_id " + " LEFT JOIN members_jobs_offer jo ON jo.id=mo.offer_id " + " WHERE mm.uid = '%s' AND jo.uid='%s' ",in["client_uid"].c_str(),in["offer_uid"].c_str() ); + if (res0 != NULL && pgsql_num_rows(res0) > 0) { + mapf = pgsql_fetch_assoc(res0, 0); + if (!f.empty()) { + CVars rec1; + map_to_cvars(f, rec1); + in = rec1; + } + }else { + out["status"] = "Not found."; + return ret; + } + + long interest_id = REQ_LONG(in, "interest_id", 1, -1); - long interest = REQ_LONG(in, "interest", 1, -1); + // long interest = REQ_LONG(in, "interest", 1, -1); //REQ_STRING (in, "offer_code", 1, 15, "(.*)"); //offer_code if (interest == JOB_INTEREST_ACCEPT || interest == JOB_INTEREST_REJECT || interest == JOB_INTEREST_CANCEL) { // is job still valid - const PGresult *res = pgsql_query("SELECT mi.id,mi.member_id AS job_interest_client_id, mo.*,mo.id AS offer_id FROM members_offer_interest mi LEFT JOIN members_jobs_offer mo ON mo.id=mi.offer_id WHERE mo.status IN (1,4) AND mi.status=1 AND mi.id = %lu", in["interest_id"].Long()); + const PGresult *res = pgsql_query("SELECT mi.id,mi.member_id AS job_interest_client_id, mo.*,mo.id AS offer_id " + " FROM members_offer_interest mi LEFT JOIN members_jobs_offer mo ON mo.id=mi.offer_id " + " WHERE mo.status IN (1,4) AND mi.status=1 AND mi.id = %lu", in["interest_id"].Long()); if (res != NULL && pgsql_num_rows(res) > 0) { mapf = pgsql_fetch_assoc(res, 0); if (!f.empty()) { @@ -576,9 +626,6 @@ long WrenchJobsProcessInterest(CVars in, CVars &out) { } - - - return ret; }