From 290a6114cb6c9a652781ca184d71c1a9d52b6510 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Mon, 29 May 2023 13:42:29 -0400 Subject: [PATCH] Offer id --- wrenchboard/src/shared_tool/jobs.cc | 14 ++++++++------ www-api/app/Config/Routes.php | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/wrenchboard/src/shared_tool/jobs.cc b/wrenchboard/src/shared_tool/jobs.cc index 4a80b7a3..0678e038 100644 --- a/wrenchboard/src/shared_tool/jobs.cc +++ b/wrenchboard/src/shared_tool/jobs.cc @@ -533,6 +533,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) { REQ_STRING(in, "offer_code", 1, 15, "(.*)"); long job_id = 0; long owner_member_id = 0; + long offer_id = 0; long rc = 0; CVars outx; @@ -540,7 +541,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) { - const PGresult *res = pgsql_query("SELECT *,member_id AS owner_member_id FROM members_jobs_offer WHERE offer_code='%s' AND status = 1", in["offer_code"].c_str()); + const PGresult *res = pgsql_query("SELECT *,member_id AS owner_member_id, id AS offer_id FROM members_jobs_offer WHERE offer_code='%s' AND status = 1", in["offer_code"].c_str()); if (res != NULL && pgsql_num_rows(res) > 0) { // now job is valid @@ -550,6 +551,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) { CVars rec; map_to_cvars(f, rec); job_id = rec["job_id"]; + offer_id = rec["offer_id"]; owner_member_id = rec["owner_member_id"]; } @@ -617,8 +619,8 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) { in["contract_id"] = contract_id; in["contract_id"].set_valid(true); pgsql_exec("UPDATE members_jobs_contract SET delivery_date = now() +'%lu days' WHERE id = %lu", x["timeline_days"].Long(), contract_id); - pgsql_exec("UPDATE members_jobs_offer SET status = 5 WHERE id = %lu AND offer_code='%s' ", out["offer_id"].Long(), in["offer_code"].c_str()); - pgsql_exec("UPDATE members_payments SET what_contract = %lu WHERE what_offer = %lu ", contract_id, in["offer_id"].Long()); + pgsql_exec("UPDATE members_jobs_offer SET status = 5 WHERE id = %lu AND offer_code='%s' ", offer_id, in["offer_code"].c_str()); + pgsql_exec("UPDATE members_payments SET what_contract = %lu WHERE what_offer = %lu ", contract_id, offer_id); job_email(JOBS_OFFER_ACCEPT_MAIL, in, out); // note the email will come from contract table now } @@ -641,7 +643,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) { y["payment_id"].set_valid(true); if (WrenchRefundoffer(y, out) == PHP_CREATED_OK) { - pgsql_exec("UPDATE members_jobs_offer SET status = 3 WHERE id = %lu AND offer_code='%s' ", out["offer_id"].Long(), in["offer_code"].c_str()); + pgsql_exec("UPDATE members_jobs_offer SET status = 3 WHERE id = %lu AND offer_code='%s' ", offer_id, in["offer_code"].c_str()); // REFUND THE MONEY job_email(JOBS_OFFER_REJECT_MAIL, in, out); // the email will come from offer table } @@ -665,7 +667,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) { y["payment_id"].set_valid(true); if (WrenchRefundoffer(y, out) == PHP_CREATED_OK) { - pgsql_exec("UPDATE members_jobs_offer SET status = 4 WHERE id = %lu AND offer_code='%s' ", out["offer_id"].Long(), in["offer_code"].c_str()); + pgsql_exec("UPDATE members_jobs_offer SET status = 4 WHERE id = %lu AND offer_code='%s' ", offer_id, in["offer_code"].c_str()); // REFUND THE MONEY job_email(JOBS_OFFER_CANCEL_MAIL, y, out); // the email will come from offer table } @@ -688,7 +690,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) { y["payment_id"] = out["payment_id"]; y["payment_id"].set_valid(true); if (WrenchRefundoffer(y, out) == PHP_CREATED_OK) { - pgsql_exec("UPDATE members_jobs_offer SET status = 4 WHERE id = %lu AND offer_code='%s' ", out["offer_id"].Long(), in["offer_code"].c_str()); + pgsql_exec("UPDATE members_jobs_offer SET status = 4 WHERE id = %lu AND offer_code='%s' ", offer_id, in["offer_code"].c_str()); // REFUND THE MONEY //job_email(JOBS_OFFER_CANCEL_MAIL, in, out); // the email will come from offer table } diff --git a/www-api/app/Config/Routes.php b/www-api/app/Config/Routes.php index 26fa3edb..4c41e004 100644 --- a/www-api/app/Config/Routes.php +++ b/www-api/app/Config/Routes.php @@ -138,7 +138,7 @@ $routes->post('/en/wrench/api/v1/assigntask', 'WrenchApi::apigate'); //$routes->post('/en/wrench/api/v1/blogitem', 'WrenchBlog::apigate'); -$routes->get('/en/wrench/api/v1/resources', 'WrenchResources::website'); +$routes->post('/en/wrench/api/v1/resources', 'WrenchResources::website'); $routes->get('/en/wrench/api/v1/blogdata/', 'WrenchBlog::website'); $routes->get('/en/wrench/api/v1/blogdata/(:any)', 'WrenchBlog::blogLimitedData/$1');