Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	config/logging.php
gogs 3 months ago
parent
commit
a90eeb82f5

+ 8 - 8
app/Http/Controllers/Api/JobController.php

@@ -37,14 +37,14 @@ class JobController extends BaseController
         echo $request->get('verify');die;
     }
 
-    //有人云(朗峰)
-    public function processDataJobAddDeviceManLf(Request $request){
-//        Log::channel('apiLog')->info('lf源数据', ["param" => $request->toArray()]);
-
-        dispatch(new ManDeviceJobLf($request->all()))->onQueue('man_device_lf');
-
-        echo $request->get('verify');die;
-    }
+//    //有人云(朗峰)
+//    public function processDataJobAddDeviceManLf(Request $request){
+////        Log::channel('apiLog')->info('lf源数据', ["param" => $request->toArray()]);
+//
+//        dispatch(new ManDeviceJobLf($request->all()))->onQueue('man_device_lf');
+//
+//        echo $request->get('verify');die;
+//    }
 
     public function delKey(Request $request){return;
         $token_key = 'big_king_login_token';

+ 138 - 6
app/Http/Controllers/Api/TestController.php

@@ -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));
+    }
+    //跳板------------------------------------------
 }

+ 0 - 1
config/ip.php

@@ -3,5 +3,4 @@
 return [
     'cs' => 'http://121.36.142.167:7774/', //测试
     'zs' => 'http://122.112.250.253:7774/', //正式
-    'zslf' => 'https://gzy.qingyaokeji.com/', //正式朗峰
 ];

+ 8 - 1
config/logging.php

@@ -113,13 +113,20 @@ return [
             'level' => 'debug',
             'days' => 200,
         ],
-        //接口日志记录
+        //商标机接口日志记录
         'apiLog' => [
             'driver' => 'daily',
             'path' => storage_path('logs/api_log.log'),
             'level' => 'debug',
             'days' => 200,
         ],
+        //跳板接口日志记录
+        'apiDwy' => [
+            'driver' => 'daily',
+            'path' => storage_path('logs/api_log.log'),
+            'level' => 'debug',
+            'days' => 200,
+        ],
     ],
 
 ];

+ 5 - 1
routes/api.php

@@ -42,7 +42,6 @@ Route::any('login', 'Api\LoginController@login');
 Route::any('job', 'Api\JobController@processDataJobAdd');
 Route::any('job_device', 'Api\JobController@processDataJobAddDevice');
 Route::any('man_device', 'Api\JobController@processDataJobAddDeviceMan');
-Route::any('man_device_lf', 'Api\JobController@processDataJobAddDeviceManLf');
 //通道门传输的数据保存单号
 Route::any('setOrderNumber', 'Api\InOutOptionController@setOrderNumber');
 //获取单号
@@ -74,6 +73,11 @@ Route::any('boxOut1', 'Api\JobController@labelDealCs');
 Route::any('getObsUrl', 'Api\DwyController@getObsUrl');
 Route::any('getCbLog', 'Api\LoginController@getCbLog');
 
+//跳板
+Route::any('testdwy','Api\TestController@testdwy');
+Route::any('testdwyget','Api\TestController@testdwyget');
+Route::any('testdwyput','Api\TestController@testdwyput');
+Route::any('testdwydel','Api\TestController@testdwydel');
 Route::group(['middleware'=> []],function ($route){
     $route->any('menuAdd', 'Api\SysMenuController@add');
     $route->any('menuEdit', 'Api\SysMenuController@edit');