|
@@ -3,15 +3,11 @@
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
|
|
|
|
|
-use App\Model\BoxDetail;
|
|
|
-use App\Service\Box\BoxHookService;
|
|
|
use App\Service\DwyService;
|
|
|
use App\Service\LabelDealService;
|
|
|
-use App\Service\MeasureService;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
-
|
|
|
class TestController extends BaseController
|
|
|
{
|
|
|
private $ivBytes = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F";
|
|
@@ -46,7 +42,6 @@ class TestController extends BaseController
|
|
|
return urlencode(base64_encode($hash_hmac));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public function boxInsert(){
|
|
|
$data = [
|
|
|
'out_order_no' => 'test123',
|
|
@@ -108,7 +103,6 @@ class TestController extends BaseController
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public function encryption($jsonToString, $saltKey, $aesEncRequestKey) {
|
|
|
$this->aesKey = $aesEncRequestKey;
|
|
|
$this->saltIVKey = $saltKey;
|
|
@@ -150,12 +144,150 @@ class TestController extends BaseController
|
|
|
return hex2bin($sHexData);
|
|
|
}
|
|
|
|
|
|
+ //跳板------------------------------------------
|
|
|
+ public function testdwy(Request $request){
|
|
|
+ $data = $request->all();
|
|
|
|
|
|
+ $url = $data['url'];
|
|
|
+ $post = $data['post'];
|
|
|
+ $header = $data['header'];
|
|
|
|
|
|
+ if(empty($post)){
|
|
|
+ $json = json_encode((object)$post);
|
|
|
+ }else{
|
|
|
+ $json = json_encode($post);
|
|
|
+ }
|
|
|
+ // $json = str_replace('"workflowSearchBean":{}','"workflowSearchBean":[]',json_encode($post));
|
|
|
+ $json = str_replace('"workflowSearchBean":[]','"workflowSearchBean":{}',$json);
|
|
|
+ $json = str_replace('"loginBindingParameters":[]','"loginBindingParameters":{}',$json);
|
|
|
+
|
|
|
+ Log::channel('apiDwy')->info('POST入参:', ["api" => $url , "param" => $json ,"header" => $header]);
|
|
|
+
|
|
|
+ $curl = curl_init();
|
|
|
+ curl_setopt_array($curl, array(
|
|
|
+ CURLOPT_URL => $url,
|
|
|
+ CURLOPT_RETURNTRANSFER => true,
|
|
|
+ CURLOPT_ENCODING => '',
|
|
|
+ CURLOPT_MAXREDIRS => 10,
|
|
|
+ CURLOPT_TIMEOUT => 0,
|
|
|
+ CURLOPT_FOLLOWLOCATION => true,
|
|
|
+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
|
+ CURLOPT_CUSTOMREQUEST => 'POST',
|
|
|
+ CURLOPT_POSTFIELDS => $json,
|
|
|
+ CURLOPT_HTTPHEADER => $header,
|
|
|
+ CURLOPT_SSL_VERIFYPEER =>false,
|
|
|
+ ));
|
|
|
+ $response = curl_exec($curl);
|
|
|
+ if ($response === false) {
|
|
|
+ // 获取错误号
|
|
|
+ $errorNumber = curl_errno($curl);
|
|
|
+ // 获取错误信息
|
|
|
+ $errorMessage = curl_error($curl);
|
|
|
+ $message = "cURL Error #{$errorNumber}: {$errorMessage}";
|
|
|
+ Log::channel('apiDwy')->info('POST结果:', ["message" => $message]);
|
|
|
+ // return [false, "cURL Error #{$errorNumber}: {$errorMessage}"];
|
|
|
+ }
|
|
|
+ curl_close($curl);
|
|
|
+ $return = json_decode($response,true);
|
|
|
|
|
|
+ Log::channel('apiDwy')->info('POST结果:', ["message" => $return]);
|
|
|
|
|
|
+ return $this->json_return(200,'', $return);
|
|
|
+ }
|
|
|
|
|
|
+ public function testdwyget(Request $request){
|
|
|
+ $data = $request->all();
|
|
|
+
|
|
|
+ $url = $data['url'];
|
|
|
+ $str = "api/module-data/production_orders/production_orders/diy/production_manage";
|
|
|
+ if (strpos($data['url'], $str) !== false) $url = "https://clouddevice.qingyaokeji.com/api/newsczt";
|
|
|
+ $str = "api/module-data/production_orders/production_orders/diy/device";
|
|
|
+ if (strpos($data['url'], $str) !== false) $url = "https://clouddevice.qingyaokeji.com/api/newdjg";
|
|
|
+ $header = $data['header'];
|
|
|
+
|
|
|
+ $curl = curl_init();
|
|
|
+
|
|
|
+ curl_setopt_array($curl, array(
|
|
|
+ CURLOPT_URL => $url,
|
|
|
+ CURLOPT_RETURNTRANSFER => true,
|
|
|
+ CURLOPT_ENCODING => '',
|
|
|
+ CURLOPT_MAXREDIRS => 10,
|
|
|
+ CURLOPT_TIMEOUT => 0,
|
|
|
+ CURLOPT_FOLLOWLOCATION => true,
|
|
|
+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
|
+ CURLOPT_CUSTOMREQUEST => 'GET',
|
|
|
+ CURLOPT_HTTPHEADER => $header,
|
|
|
+ ));
|
|
|
+ $response = curl_exec($curl);
|
|
|
+ curl_close($curl);
|
|
|
+ return $this->json_return(200,'',json_decode($response,true));
|
|
|
+ }
|
|
|
|
|
|
+ public function testdwyput(Request $request){
|
|
|
+ $data = $request->all();
|
|
|
+
|
|
|
+ $url = $data['url'];
|
|
|
+ $post = $data['post'];
|
|
|
+ $header = $data['header'];
|
|
|
+
|
|
|
+ $json = str_replace('"workflowSearchBean":{}','"workflowSearchBean":[]',json_encode($post));
|
|
|
+ $json = str_replace('"workflowSearchBean":[]','"workflowSearchBean":{}',json_encode($post));
|
|
|
+
|
|
|
+ Log::channel('apiDwy')->info('PUT入参:', ["api" => $url , "param" => $json ,"header" => $header]);
|
|
|
+
|
|
|
+ $curl = curl_init();
|
|
|
+ curl_setopt_array($curl, array(
|
|
|
+ CURLOPT_URL => $url,
|
|
|
+ CURLOPT_RETURNTRANSFER => true,
|
|
|
+ CURLOPT_ENCODING => '',
|
|
|
+ CURLOPT_MAXREDIRS => 10,
|
|
|
+ CURLOPT_TIMEOUT => 0,
|
|
|
+ CURLOPT_FOLLOWLOCATION => true,
|
|
|
+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
|
+ CURLOPT_CUSTOMREQUEST => 'PUT',
|
|
|
+ CURLOPT_POSTFIELDS => $json,
|
|
|
+ CURLOPT_HTTPHEADER => $header,
|
|
|
+ ));
|
|
|
+ $response = curl_exec($curl);
|
|
|
+ if ($response === false) {
|
|
|
+ // 获取错误号
|
|
|
+ $errorNumber = curl_errno($curl);
|
|
|
+ // 获取错误信息
|
|
|
+ $errorMessage = curl_error($curl);
|
|
|
+ $message = "cURL Error #{$errorNumber}: {$errorMessage}";
|
|
|
+ Log::channel('apiDwy')->info('PUT结果:', ["message" => $message]);
|
|
|
+ // return [false, "cURL Error #{$errorNumber}: {$errorMessage}"];
|
|
|
+ }
|
|
|
+ curl_close($curl);
|
|
|
+ $return = json_decode($response,true);
|
|
|
|
|
|
+ Log::channel('apiDwy')->info('PUT结果:', ["message" => $return]);
|
|
|
|
|
|
+ return $this->json_return(200,'', $return);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testdwydel(Request $request){
|
|
|
+ $data = $request->all();
|
|
|
+
|
|
|
+ $url = $data['url'];
|
|
|
+ $header = $data['header'];
|
|
|
+
|
|
|
+ $curl = curl_init();
|
|
|
+
|
|
|
+ curl_setopt_array($curl, array(
|
|
|
+ CURLOPT_URL => $url,
|
|
|
+ CURLOPT_RETURNTRANSFER => true,
|
|
|
+ CURLOPT_ENCODING => '',
|
|
|
+ CURLOPT_MAXREDIRS => 10,
|
|
|
+ CURLOPT_TIMEOUT => 0,
|
|
|
+ CURLOPT_FOLLOWLOCATION => true,
|
|
|
+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
|
+ CURLOPT_CUSTOMREQUEST => 'DELETE',
|
|
|
+ CURLOPT_HTTPHEADER => $header,
|
|
|
+ ));
|
|
|
+ $response = curl_exec($curl);
|
|
|
+ curl_close($curl);
|
|
|
+ return $this->json_return(200,'',json_decode($response,true));
|
|
|
+ }
|
|
|
+ //跳板------------------------------------------
|
|
|
}
|