Wrencg Jobs

This commit is contained in:
CHIEFSOFT\ameye
2024-02-24 18:42:35 -05:00
parent 9651fd0a40
commit 9fe763caff
2 changed files with 38 additions and 3 deletions
+2 -1
View File
@@ -70,7 +70,8 @@ $routes->post('/en/wrench/api/v1/homebanners', 'WrenchApi::apigate');
$routes->post('/en/wrench/api/v1/startjoblist', 'WrenchApi::apigate');
$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', 'WrenchApi::apigate');
$routes->post('/en/wrench/api/v1/getjobsdata', 'WrenchJobs::apigate'); //WrenchJobs WrenchApi
$routes->post('/en/wrench/api/v1/offerslist', 'WrenchApi::apigate');
$routes->post('/en/wrench/api/v1/offersresponse', 'WrenchApi::apigate');
+36 -2
View File
@@ -89,9 +89,16 @@ class WrenchJobs extends BaseController
// TOKEN VERIFICATION WILL GAPPEN
}
switch($endpoint) {
case 'getjobsdata':
$in["action"] = 'marketjobs'; //WRENCHBOARD_ACCOUNT_JOBLIST;
break;
}
if ( $call_backend == true && $in["action"] !='' ){
$wrenchboard = new \App\Models\BackendModel();
$ret = $wrenchboard->wrenchboard_api($in, $out);
// $wrenchboard = new \App\Models\BackendModel();
$ret = $this->wrenchboard_api($in, $out);
$out['internal_return'] = $ret;
}
else
@@ -109,6 +116,33 @@ class WrenchJobs extends BaseController
return json_encode( $final_out );
}
public function wrenchboard_api($in, &$out = array(),$pathWay='') {
$ret = 0;
$local_url = "http://10.10.10.120:3033/marketjobs";
$url = $local_url ; // ."/".$urlPath; //"/generics";
$data = $in;
$content = json_encode($data);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type" => "application/json"));
curl_setopt($curl, CURLOPT_POST, false); // true to make POST
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($status != 200) {
echo ("Error: call to URL $url failed with status $status, response $json_response, | curl_error " . curl_error($curl) . ", | curl_errno " . curl_errno($curl));
}
curl_close($curl);
$response = json_decode($json_response, true);
$out = $response;
return $response["internal_return"];
}
}