Commit 17dd1924 by 杨树贤

修复数据

parent 6abe0249
......@@ -86,6 +86,13 @@ RABBITMQ_LOGIN=guest
RABBITMQ_PASSWORD=guest
RABBITMQ_QUEUE=wms_service
RABBITMQ2_HOST=192.168.1.252
RABBITMQ2_PORT=5672
RABBITMQ2_VHOST=/
RABBITMQ2_LOGIN=guest
RABBITMQ2_PASSWORD=guest
RABBITMQ2_QUEUE=wms_service
#RABBITMQ_HOST=192.168.1.237
#RABBITMQ_PORT=5672
#RABBITMQ_VHOST=/
......
......@@ -20,4 +20,18 @@ class QueueService
array('content_type' => 'text/plain'));
$channel->basic_publish($msg, '', $queueName);
}
public static function publishQueueSecond($queueName, $data)
{
$conn = new AMQPStreamConnection(config('database.connections.rabbitmq2.host'),
config('database.connections.rabbitmq2.port'),
config('database.connections.rabbitmq2.login'),
config('database.connections.rabbitmq2.password'));
$channel = $conn->channel();
$channel->queue_declare($queueName, false, true, false, false);
$msg = new AMQPMessage(json_encode($data),
array('content_type' => 'text/plain'));
$channel->basic_publish($msg, '', $queueName);
}
}
......@@ -57,7 +57,7 @@ class SkuService
$sku['encap'] = array_get($spu, 'encap', '');
//制造商处理
if (empty($sku['brand_name']) && !empty($spu)) {
$brand = $redis->hget('brand_id', $spu['brand_id']);
$brand = $redis->hget('brand', $spu['brand_id']);
if ($brand) {
$sku['brand_name'] = $brand;
} else {
......@@ -187,7 +187,7 @@ class SkuService
$queueData['down_type'] = 2;
$queueData['data'] = $skuIds;
}
QueueService::publishQueue($queueName, $queueData);
QueueService::publishQueueSecond($queueName, $queueData);
} catch (\Exception $exception) {
return $exception;
}
......
......@@ -206,6 +206,16 @@ return [
'queue' => env('RABBITMQ_QUEUE'), // name of the default queue,
],
'rabbitmq2' => [
'driver' => 'rabbitmq',
'host' => env('RABBITMQ2_HOST', '127.0.0.1'),
'port' => env('RABBITMQ2_PORT', 5672),
'vhost' => env('RABBITMQ2_VHOST', '/'),
'login' => env('RABBITMQ2_LOGIN', 'guest'),
'password' => env('RABBITMQ2_PASSWORD', 'guest'),
'queue' => env('RABBITMQ_QUEUE'), // name of the default queue,
],
],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment