|
@@ -46,7 +46,11 @@ 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()
|
|
@@ -84,7 +88,6 @@ class VirusAdd extends Command
|
|
|
*/
|
|
|
public function handle()
|
|
|
{
|
|
|
- Log::info('接收一条消息');
|
|
|
$queue_name = $this->queue;
|
|
|
$this->channel->queue_declare($queue_name, false, true, false, false);
|
|
|
$this->channel->queue_bind($queue_name, $this->queue);
|
|
@@ -110,13 +113,7 @@ class VirusAdd extends Command
|
|
|
|
|
|
private function send($data)
|
|
|
{
|
|
|
- // 初始化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));
|
|
|
+ Log::debug('client:'.json_encode);
|
|
|
try {
|
|
|
// 签名设置
|
|
|
$signKey = [
|
|
@@ -186,7 +183,7 @@ class VirusAdd extends Command
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- $response = $virusClient->request('POST', config('customer.VIRUS_URL').'/v2/record/add', [
|
|
|
+ $response = $this->client->request('POST', '/v2/record/add', [
|
|
|
'headers' => [
|
|
|
'Content-Type' => 'application/json'
|
|
|
],
|