Data routes
This commit is contained in:
@@ -71,7 +71,7 @@ $routes->post('/en/wrench/api/v1/startjoblist', 'WrenchApi::apigate');
|
|||||||
$routes->get('/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/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/offerslist', 'WrenchApi::apigate');
|
||||||
$routes->post('/en/wrench/api/v1/offersresponse', 'WrenchApi::apigate');
|
$routes->post('/en/wrench/api/v1/offersresponse', 'WrenchApi::apigate');
|
||||||
|
|||||||
@@ -97,9 +97,10 @@ class WrenchJobs extends BaseController
|
|||||||
|
|
||||||
|
|
||||||
if ( $call_backend == true && $in["action"] !='' ){
|
if ( $call_backend == true && $in["action"] !='' ){
|
||||||
// $wrenchboard = new \App\Models\BackendModel();
|
$local_url = "http://10.10.10.120:3033/marketjobs";
|
||||||
$ret = $this->wrenchboard_api($in, $out);
|
$out = APIcall('GET', $local_url, $in);
|
||||||
$out['internal_return'] = $ret;
|
// $ret = $this->APIcall($in, $out);
|
||||||
|
// $out['internal_return'] = $ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -116,6 +117,40 @@ class WrenchJobs extends BaseController
|
|||||||
return json_encode( $final_out );
|
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='') {
|
public function wrenchboard_api($in, &$out = array(),$pathWay='') {
|
||||||
$ret = 0;
|
$ret = 0;
|
||||||
$local_url = "http://10.10.10.120:3033/marketjobs";
|
$local_url = "http://10.10.10.120:3033/marketjobs";
|
||||||
|
|||||||
Reference in New Issue
Block a user