Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenchuanwen
my-yaf-project
Commits
06862162
Commit
06862162
authored
Jan 03, 2019
by
chenchuanwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bridgestart
parent
5b37a670
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
10 deletions
+22
-10
bridge.php
scripts/crontab/push/bridge.php
+0
-2
bridgeStart.php
scripts/crontab/push/bridgeStart.php
+22
-8
No files found.
scripts/crontab/push/bridge.php
View file @
06862162
...
...
@@ -8,8 +8,6 @@
define
(
"APPLICATION_PATH"
,
realpath
(
dirname
(
__FILE__
)
.
'/../../../'
));
//指向public的上一级
require_once
APPLICATION_PATH
.
'/scripts/crontab/common.php'
;
$conf
=
\Yaf\Registry
::
get
(
'config'
)
->
get
(
'redis.database.params'
);
$http
=
new
swoole_http_server
(
"0.0.0.0"
,
9501
);
$http
->
on
(
'request'
,
function
(
$request
,
$response
)
{
try
{
...
...
scripts/crontab/push/bridgeStart.php
View file @
06862162
...
...
@@ -3,7 +3,7 @@ define("APPLICATION_PATH", realpath(dirname(__FILE__) . '/../../../')); //指向
require
APPLICATION_PATH
.
'/scripts/crontab/baseCli.php'
;
require
APPLICATION_PATH
.
'/scripts/crontab/common.php'
;
error_reporting
(
E_ALL
^
E_NOTICE
);
class
runRedisPush
class
bridgeStart
{
/* config */
const
LISTEN
=
"tcp://192.168.2.15:5555"
;
...
...
@@ -42,6 +42,10 @@ class runRedisPush
return
(
getmypid
());
}
}
public
function
callback
(
$instance
,
$channelName
,
$message
){
$orderService
=
\Business\Order\OrderServiceModel
::
getInstance
();
$orderService
->
testPush
(
$message
);
}
protected
function
status
(){
if
(
file_exists
(
$this
->
pidfile
))
{
$pid
=
file_get_contents
(
$this
->
pidfile
);
...
...
@@ -50,13 +54,10 @@ class runRedisPush
printf
(
"%s haven't running
\n
"
,
$this
->
argv
[
0
]);
}
}
public
function
callback
(
$instance
,
$channelName
,
$message
){
$orderService
=
\Business\Order\OrderServiceModel
::
getInstance
();
$orderService
->
testPush
(
$message
);
}
private
function
start
()
{
$pid
=
$this
->
daemon
();
$conf
=
\Yaf\Registry
::
get
(
'config'
)
->
get
(
'redis.database.params'
);
$http
=
new
swoole_http_server
(
"0.0.0.0"
,
9501
);
$http
->
on
(
'request'
,
function
(
$request
,
$response
)
{
try
{
...
...
@@ -93,6 +94,13 @@ class runRedisPush
$http
->
start
();
}
private
function
reload
(){
if
(
file_exists
(
$this
->
pidfile
))
{
$pid
=
file_get_contents
(
$this
->
pidfile
);
//posix_kill(posix_getpid(), SIGHUP);
posix_kill
(
$pid
,
SIGHUP
);
}
}
protected
function
restart
(){
$this
->
stop
();
$this
->
start
();
...
...
@@ -112,9 +120,10 @@ class runRedisPush
{
printf
(
"%s start | stop | help | restart | reload
\n
"
,
$proc
);
}
private
$argv
;
public
function
main
(
$argv
)
{
$this
->
argv
=
$argv
;
if
(
count
(
$argv
)
<
2
)
{
printf
(
"please input help parameter
\n
"
);
exit
();
...
...
@@ -126,11 +135,16 @@ class runRedisPush
$this
->
start
();
}
else
if
(
$argv
[
1
]
===
'restart'
){
$this
->
restart
();
}
else
{
}
else
if
(
$argv
[
1
]
===
'status'
){
$this
->
status
();
}
else
if
(
$argv
[
1
]
===
'reload'
){
$this
->
reload
();
}
else
{
$this
->
help
(
$argv
[
0
]);
}
}
}
$cgse
=
new
runRedisPush
();
$cgse
=
new
bridgeStart
();
$cgse
->
main
(
$argv
);
\ No newline at end of file
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