Data routes

This commit is contained in:
CHIEFSOFT\ameye
2024-02-24 19:46:00 -05:00
parent 0f57f82788
commit 149b0fa9e7
2 changed files with 39 additions and 4 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ $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'); //WrenchJobs WrenchApi
$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');
+38 -3
View File
@@ -97,9 +97,10 @@ class WrenchJobs extends BaseController
if ( $call_backend == true && $in["action"] !='' ){
// $wrenchboard = new \App\Models\BackendModel();
$ret = $this->wrenchboard_api($in, $out);
$out['internal_return'] = $ret;
$local_url = "http://10.10.10.120:3033/marketjobs";
$out = APIcall('GET', $local_url, $in);
// $ret = $this->APIcall($in, $out);
// $out['internal_return'] = $ret;
}
else
{
@@ -116,6 +117,40 @@ class WrenchJobs extends BaseController
return json_encode( $final_out );
}
public function APIcall($method, $url, $data) {
// $curl = curl_init();
$curl = curl_init($url);
switch ($method) {
case "POST":
curl_setopt($curl, CURLOPT_POST, 1);
if ($data)
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
break;
case "PUT":
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
if ($data)
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
break;
}
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'APIKEY: RegisteredAPIkey',
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$result = curl_exec($curl);
if(!$result) {
echo("Connection failure!");
}
curl_close($curl);
return $result;
}
public function wrenchboard_api($in, &$out = array(),$pathWay='') {
$ret = 0;
$local_url = "http://10.10.10.120:3033/marketjobs";