wzq 5 年之前
父節點
當前提交
3c07fe1647
共有 1 個文件被更改,包括 10 次插入9 次删除
  1. 10 9
      app/Console/Commands/VirusAdd.php

+ 10 - 9
app/Console/Commands/VirusAdd.php

@@ -46,12 +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->virusClient = new Client([
-            'base_uri' => config('customer.VIRUS_URL'),
-            'timeout' => 3
-        ]);
-        Log::debug('virusClient:'.json_encode($this->virusClient));
+
     }
 
     public function getConnection()
@@ -115,7 +110,13 @@ class VirusAdd extends Command
 
     private function send($data)
     {
-        Log::debug('client:'.json_encode($this->virusClient));
+        // 初始化virus域名
+        $virusClient = new Client([
+            'base_uri' => config('customer.VIRUS_URL'),
+            'timeout' => 3
+        ]);
+        Log::debug('VIRUS_URL:'.json_encode(config('customer.VIRUS_URL')));
+        Log::debug('client:'.json_encode($virusClient));
         try {
             // 签名设置
             $signKey = [
@@ -182,10 +183,10 @@ class VirusAdd extends Command
                 ];
             }else{
                 Log::debug('行为类型错误'.json_encode($data));
-                return false;
+                return true;
             }
 
-            $response = $this->virusClient->request('POST', '/v2/record/add', [
+            $response = $virusClient->request('POST', '/v2/record/add', [
                 'headers' => [
                     'Content-Type' => 'application/json'
                 ],