Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
17dd1924
authored
May 31, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复数据
parent
6abe0249
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
2 deletions
.env
app/Http/Services/QueueService.php
app/Http/Services/SkuService.php
config/database.php
.env
View file @
17dd1924
...
...
@@ -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=/
...
...
app/Http/Services/QueueService.php
View file @
17dd1924
...
...
@@ -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
);
}
}
app/Http/Services/SkuService.php
View file @
17dd1924
...
...
@@ -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
::
publishQueue
Second
(
$queueName
,
$queueData
);
}
catch
(
\Exception
$exception
)
{
return
$exception
;
}
...
...
config/database.php
View file @
17dd1924
...
...
@@ -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,
],
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment