From 70557f741910c0586910c0497320681c10d2acd8 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Thu, 22 Aug 2024 05:16:42 -0400 Subject: [PATCH] verify completed jobs --- www-api/app/Config/RoutesV1.php | 1 + www-api/app/Controllers/WrenchJobs.php | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/www-api/app/Config/RoutesV1.php b/www-api/app/Config/RoutesV1.php index 4ef30706..0c9afc22 100644 --- a/www-api/app/Config/RoutesV1.php +++ b/www-api/app/Config/RoutesV1.php @@ -41,6 +41,7 @@ $routes->get('/en/wrench/api/v1/startjoblist', 'WrenchApi::apigate'); $routes->post('/en/wrench/api/v1/dashdata', 'WrenchApi::apigate'); $routes->post('/en/wrench/api/v1/getjobsdata', 'WrenchJobs::getJobsData'); //WrenchJobs WrenchApi apigate +$routes->post('/en/wrench/api/v1/verifycompleted', 'WrenchJobs::verifyCompletedHx'); $routes->post('/en/wrench/api/v1/offerslist', 'WrenchApi::apigate'); $routes->post('/en/wrench/api/v1/offersresponse', 'WrenchApi::apigate'); diff --git a/www-api/app/Controllers/WrenchJobs.php b/www-api/app/Controllers/WrenchJobs.php index 68d51254..0074cac8 100644 --- a/www-api/app/Controllers/WrenchJobs.php +++ b/www-api/app/Controllers/WrenchJobs.php @@ -12,6 +12,25 @@ class WrenchJobs extends BaseController $this->request = $request = \Config\Services::request(); } + public function verifyCompletedHx(){ + //http://localhost:3033/completedHx + $raw_json = file_get_contents('php://input'); + $in = json_decode($raw_json, true); + $in["action"] = -1; + $out=[]; + $endpoint = "COMPLETED_HX-". $in["uid"]; + + $out = $this->getCache($endpoint); + if ( count($out)==0 ){ + $local_url = "http://".$this->micro_service_net1.":3033/completedHx"; + $out = $this->APIcall('GET', $local_url, $in); + $this->saveCache($endpoint,$out,10000); + $out['internal_return'] = 0; // just backwad comaptobility + log_message('critical', "***** ***** WrenchJobs::verifyCompletedHx Cache Done:::Ret "); + } + log_message('critical', "***** ***** WrenchJobs::verifyCompletedHx Ret "); + return $this->respond( $this->summaryReturnData($in,$out), 200); + } public function getJobsData() { $raw_json = file_get_contents('php://input'); $in = json_decode($raw_json, true);