wzq пре 5 година
родитељ
комит
aa8a58d5f4
1 измењених фајлова са 6 додато и 6 уклоњено
  1. 6 6
      app/Console/Commands/VirusAdd.php

+ 6 - 6
app/Console/Commands/VirusAdd.php

@@ -46,11 +46,7 @@ class VirusAdd extends Command
         $this->connection = $this->getConnection();
         $this->channel = $this->connection->channel();
         $this->channel->exchange_declare($this->queue, 'fanout', false, true, false);
-        // 初始化virus域名
-        $this->client = new Client([
-            'base_uri' => config('customer.VIRUS_URL'),
-            'timeout' => 3
-        ]);
+
     }
 
     public function getConnection()
@@ -113,6 +109,10 @@ class VirusAdd extends Command
 
     private function send($data)
     {
+        // 初始化virus域名
+        $client = new Client([
+            'timeout' => 3
+        ]);
         try {
             // 签名设置
             $signKey = [
@@ -182,7 +182,7 @@ class VirusAdd extends Command
                 return true;
             }
 
-            $response = $this->client->request('POST', '/v2/record/add', [
+            $response = $client->request('POST', config('customer.VIRUS_URL').'/v2/record/add', [
                 'headers' => [
                     'Content-Type' => 'application/json'
                 ],