Selaa lähdekoodia

有人云设备

cqpCow 1 vuosi sitten
vanhempi
commit
f4154738d2

+ 7 - 0
app/Http/Controllers/Api/JobController.php

@@ -7,6 +7,7 @@ use App\Jobs\DesktopDeviceJob;
 use App\Jobs\ManDeviceJob;
 use App\Jobs\ProcessDataJob;
 use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Redis;
 
 
 class JobController extends BaseController
@@ -30,4 +31,10 @@ class JobController extends BaseController
 
         echo $request->get('verify');die;
     }
+
+    public function delKey(Request $request){return;
+        $token_key = 'big_king_login_token';
+//        $token = Redis::get($token_key);
+        Redis::del($token_key);
+    }
 }

+ 4 - 2
app/Jobs/DesktopDeviceJob.php

@@ -17,6 +17,7 @@ class DesktopDeviceJob implements ShouldQueue
     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
 
     protected $data;
+    protected $url;
 
     /**
      * Create a new job instance.
@@ -26,6 +27,7 @@ class DesktopDeviceJob implements ShouldQueue
     public function __construct($data)
     {
         $this->data = $data;
+        $this->url = config('ip.zs');
     }
 
     /**
@@ -64,7 +66,7 @@ class DesktopDeviceJob implements ShouldQueue
         list($status,$token) = ClearDataService::getToken();
         if(! $status) return;
 
-        $url = 'http://121.36.142.167:7774/jbl/api/module-data/dispatch_orders/page';
+        $url = $this->url . 'jbl/api/module-data/dispatch_orders/page';
         $post = [
             'direction' => 'DESC',
             'property' => 'id',
@@ -189,7 +191,7 @@ class DesktopDeviceJob implements ShouldQueue
             "showModelId" => "474382714828959744"
         ];
         //组织数据------
-        $url = 'http://121.36.142.167:7774/jbl/api/module-data/completion_orders/completion_orders';
+        $url = $this->url . 'jbl/api/module-data/completion_orders/completion_orders';
         $header = ["Authorization: Bearer {$token}","Content-Type:application/json",'Site:91451322MA5P9JNKXA'];
 
         $curl = curl_init();

+ 3 - 1
app/Jobs/ManDeviceJob.php

@@ -17,6 +17,7 @@ class ManDeviceJob implements ShouldQueue
     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
 
     protected $data;
+    protected $url;
 
     /**
      * Create a new job instance.
@@ -26,6 +27,7 @@ class ManDeviceJob implements ShouldQueue
     public function __construct($data)
     {
         $this->data = $data;
+        $this->url = config('ip.zs');
     }
 
     /**
@@ -99,7 +101,7 @@ class ManDeviceJob implements ShouldQueue
         list($status,$token) = ClearDataService::getToken();
         if(! $status) return;
 
-        $url = "http://121.36.142.167:7774/api/module-data/device_machine_record/device_machine_record";
+        $url = $this->url . "api/module-data/device_machine_record/device_machine_record";
         $post = [
             'bizId' => -1,
             'bizTypeEk' => 'LOWCODE',

+ 3 - 1
app/Jobs/ProcessDataJob.php

@@ -16,6 +16,7 @@ class ProcessDataJob implements ShouldQueue
     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
 
     protected $data;
+    protected $url;
 
     /**
      * Create a new job instance.
@@ -25,6 +26,7 @@ class ProcessDataJob implements ShouldQueue
     public function __construct($data)
     {
         $this->data = $data;
+        $this->url = config('ip.zs');
     }
 
     /**
@@ -57,7 +59,7 @@ class ProcessDataJob implements ShouldQueue
         list($status,$token) = ClearDataService::getToken();
         if(! $status) return;
 
-        $url = "http://121.36.142.167:7774/api/module-data/device_machine_record/device_machine_record";
+        $url = $this->url . "api/module-data/device_machine_record/device_machine_record";
         $post = [
             'bizId' => -1,
             'bizTypeEk' => 'LOWCODE',

+ 3 - 1
app/Jobs/SendDataJob.php

@@ -15,6 +15,7 @@ class SendDataJob implements ShouldQueue
     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
 
     protected $data;
+    protected $url;
 
     /**
      * Create a new job instance.
@@ -24,6 +25,7 @@ class SendDataJob implements ShouldQueue
     public function __construct($data)
     {
         $this->data = $data;
+        $this->url = config('ip.zs');
     }
 
     /**
@@ -63,7 +65,7 @@ class SendDataJob implements ShouldQueue
     }
 
     public function sendToDevice($data){
-        $url = "http://121.36.142.167:7774/api/module-data/device_machine_record/device_machine_record";
+        $url = $this->url . "api/module-data/device_machine_record/device_machine_record";
         $post = [
             'bizId' => -1,
             'bizTypeEk' => 'LOWCODE',

+ 2 - 1
app/Service/ClearDataService.php

@@ -157,11 +157,12 @@ class ClearDataService extends Service
         $token_key = 'big_king_login_token';
         $token = Redis::get($token_key);
         if(! $token){
+            $url = config('ip.zs');
             $post = array("name" => "admin","password"=>"admin","rememberMe"=>true);
             $header = ['Content-Type:application/json'];
             $curl = curl_init();
             curl_setopt_array($curl, array(
-                CURLOPT_URL => 'http://121.36.142.167:7774/jbl/api/mes/login',
+                CURLOPT_URL => $url . 'jbl/api/mes/login',
                 CURLOPT_RETURNTRANSFER => true,
                 CURLOPT_ENCODING => '',
                 CURLOPT_MAXREDIRS => 10,

+ 6 - 0
config/ip.php

@@ -0,0 +1,6 @@
+<?php
+//状态码
+return [
+    'cs' => 'http://121.36.142.167:7774/', //测试
+    'zs' => 'http://122.112.250.253:7774/', //正式
+];

+ 1 - 0
routes/api.php

@@ -21,6 +21,7 @@ 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('del', 'Api\JobController@delKey');
 Route::any('oee', 'Api\ScreenController@oee');
 
 Route::group(['middleware'=> []],function ($route){