Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
李洋
/
消息系统
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
d2fb461f
authored
May 24, 2019
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
同下
parent
6535b39b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
5 deletions
app/Http/Controllers/MessageApiController.php
config/website.php
app/Http/Controllers/MessageApiController.php
View file @
d2fb461f
...
@@ -558,9 +558,10 @@ class MessageApiController extends Controller
...
@@ -558,9 +558,10 @@ class MessageApiController extends Controller
$title
=
$res
[
0
];
$title
=
$res
[
0
];
unset
(
$res
[
0
]);
unset
(
$res
[
0
]);
},
'GBK'
);
},
'GBK'
);
$exchange
=
'szliexin_laravel_tasks'
;
// 交换器,在我理解,如果两个队列使用一个交换器就代表着两个队列是同步的,这个队列里存在的消息,在另一个队列里也会存在
$exchange
=
Config
(
"website.msg_exchange"
);
// 交换器,在我理解,如果两个队列使用一个交换器就代表着两个队列是同步的,这个队列里存在的消息,在另一个队列里也会存在
$queue
=
'szliexin_message_tasks002'
;
// 队列名称
$queue
=
Config
(
"website.msg_queue"
);
// 队列名称
$connection
=
new
AMQPStreamConnection
(
'192.168.1.188'
,
'5672'
,
'guest'
,
'guest'
,
'/'
);
// 创建连接
$connection
=
new
AMQPStreamConnection
(
Config
(
"website.rabbitmq.host"
),
Config
(
"website.rabbitmq.port"
),
Config
(
"website.rabbitmq.login"
),
Config
(
"website.rabbitmq.password"
),
Config
(
"website.rabbitmq.vhost"
));
// 创建连接
$channel
=
$connection
->
channel
();
$channel
=
$connection
->
channel
();
$channel
->
queue_declare
(
$queue
,
false
,
true
,
false
,
false
);
$channel
->
queue_declare
(
$queue
,
false
,
true
,
false
,
false
);
$channel
->
exchange_declare
(
$exchange
,
'direct'
,
false
,
true
,
false
);
$channel
->
exchange_declare
(
$exchange
,
'direct'
,
false
,
true
,
false
);
...
@@ -592,7 +593,7 @@ class MessageApiController extends Controller
...
@@ -592,7 +593,7 @@ class MessageApiController extends Controller
$_data
[
'rbmq'
]
=
[
$_data
[
'rbmq'
]
=
[
'expire_time'
=>
time
()
+
3600
*
2
'expire_time'
=>
time
()
+
3600
*
2
];
];
dump
(
$_data
);
//
dump($_data);
$msg_arr
[
'data'
]
=
$_data
;
$msg_arr
[
'data'
]
=
$_data
;
$msg
=
new
AMQPMessage
(
json_encode
(
$msg_arr
));
$msg
=
new
AMQPMessage
(
json_encode
(
$msg_arr
));
$channel
->
basic_publish
(
$msg
,
$exchange
);
$channel
->
basic_publish
(
$msg
,
$exchange
);
...
...
config/website.php
View file @
d2fb461f
...
@@ -12,5 +12,17 @@ return [
...
@@ -12,5 +12,17 @@ return [
'data'
=>
env
(
'DATA_DOMAIN'
,
'message.liexin.com'
),
'data'
=>
env
(
'DATA_DOMAIN'
,
'message.liexin.com'
),
"domain"
=>
"liexin.com"
"domain"
=>
"liexin.com"
,
"rabbitmq"
=>
[
'host'
=>
'192.168.1.188'
,
'port'
=>
'5672'
,
'login'
=>
'guest'
,
'password'
=>
'guest'
,
'vhost'
=>
'/'
],
"msg_exchange"
=>
'szliexin_laravel_tasks'
,
"msg_queue"
=>
'sz_batch_send_msg'
,
];
];
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