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
bdafd0bf
Commit
bdafd0bf
authored
Jan 02, 2019
by
wwccw0591
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into linqing
parents
01fc2591
eb0bf4ee
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
114 additions
and
11 deletions
+114
-11
OrderService.php
application/models/Business/Order/OrderService.php
+10
-10
redisPublish.php
public/redisPublish.php
+1
-1
redisSubscribe.php
scripts/crontab/push/redisSubscribe.php
+4
-0
runRedisPush.php
scripts/crontab/push/runRedisPush.php
+99
-0
No files found.
application/models/Business/Order/OrderService.php
View file @
bdafd0bf
...
...
@@ -1014,12 +1014,12 @@ class OrderServiceModel extends \Business\AbstractModel
$orderDao
->
db
->
doRollback
();
continue
;
}
array_push
(
$orderIds
,
$order
[
'orderId'
]);
$this
->
updateOrderGoodsStoregeByOrderIds
(
$orderIds
);
array_push
(
$newOrders
,
$order
);
$orderIds
=
array
();
$orderDao
->
db
->
doCommit
();
}
array_push
(
$orderIds
,
$order
[
'orderId'
]);
$this
->
updateOrderGoodsStoregeByOrderIds
(
$orderIds
);
array_push
(
$newOrders
,
$order
);
$orderIds
=
array
();
$orderDao
->
db
->
doCommit
();
$orderDao
->
deleteOrderCache
(
$order
[
'buyerId'
],(
string
)
$order
[
'orderId'
],
$order
[
'storeId'
],
true
);
$storeDao
->
deleteStoreCache
(
$order
[
'storeId'
],
$order
[
'orderId'
]);
$push
=
\Our\Push
::
getInstance
();
...
...
@@ -1092,12 +1092,12 @@ class OrderServiceModel extends \Business\AbstractModel
$orderDao
->
db
->
doRollback
();
continue
;
}
array_push
(
$orderIds
,
$order
[
'orderId'
]);
$this
->
updateOrderGoodsStoregeByOrderIds
(
$orderIds
);
array_push
(
$newOrders
,
$order
);
$orderIds
=
array
();
$orderDao
->
db
->
doCommit
();
}
array_push
(
$orderIds
,
$order
[
'orderId'
]);
$this
->
updateOrderGoodsStoregeByOrderIds
(
$orderIds
);
array_push
(
$newOrders
,
$order
);
$orderIds
=
array
();
$orderDao
->
db
->
doCommit
();
$orderDao
->
deleteOrderCache
(
$order
[
'buyerId'
],(
string
)
$order
[
'orderId'
],
$order
[
'storeId'
],
true
);
$storeDao
->
deleteStoreCache
(
$order
[
'storeId'
],
$order
[
'orderId'
]);
$push
=
\Our\Push
::
getInstance
();
...
...
public/redisPublish.php
View file @
bdafd0bf
...
...
@@ -3,4 +3,4 @@
$redis
=
new
Redis
();
$redis
->
connect
(
'192.168.1.201'
,
6379
);
$message
=
'happy New Year'
;
$ret
=
$redis
->
publish
(
'
pushcenter
'
,
$message
);
$ret
=
$redis
->
publish
(
'
redisPublish
'
,
$message
);
scripts/crontab/push/redisSubscribe.php
View file @
bdafd0bf
...
...
@@ -24,5 +24,9 @@ function printTest($meg){
echo
$meg
.
'213'
;
}
function
callback
(
$instance
,
$channelName
,
$message
){
if
(
$message
==
'outPid'
){
$instance
->
unsubscribe
(
array
(
$channelName
));
return
;
}
printTest
(
$message
);
}
scripts/crontab/push/runRedisPush.php
0 → 100644
View file @
bdafd0bf
<?php
define
(
"APPLICATION_PATH"
,
realpath
(
dirname
(
__FILE__
)
.
'/../../../'
));
//指向public的上一级
require
APPLICATION_PATH
.
'/scripts/crontab/baseCli.php'
;
require
APPLICATION_PATH
.
'/scripts/crontab/common.php'
;
error_reporting
(
E_ALL
^
E_NOTICE
);
class
runRedisPush
{
/* config */
const
LISTEN
=
"tcp://192.168.2.15:5555"
;
const
MAXCONN
=
100
;
const
pidfile
=
__CLASS__
;
const
uid
=
80
;
const
gid
=
80
;
/**/
protected
$pool
=
NULL
;
protected
$zmq
=
NULL
;
public
function
__construct
()
{
$this
->
pidfile
=
'/var/run/'
.
self
::
pidfile
.
'.pid'
;
}
private
function
daemon
()
{
if
(
file_exists
(
$this
->
pidfile
))
{
echo
"The file
$this->pidfile
exists.
\n
"
;
exit
();
}
$pid
=
pcntl_fork
();
if
(
$pid
==
-
1
)
{
die
(
'could not fork'
);
}
else
if
(
$pid
)
{
// we are the parent
//pcntl_wait($status); //Protect against Zombie children
exit
(
$pid
);
}
else
{
// we are the child
file_put_contents
(
$this
->
pidfile
,
getmypid
());
posix_setuid
(
self
::
uid
);
posix_setgid
(
self
::
gid
);
return
(
getmypid
());
}
}
private
function
start
()
{
$pid
=
$this
->
daemon
();
$conf
=
\Yaf\Registry
::
get
(
'config'
)
->
get
(
'redis.database.params'
);
$redis
=
new
Redis
();
$redis
->
connect
(
$conf
[
'host'
],
$conf
[
'port'
]);
if
(
!
empty
(
$conf
[
'password'
])){
$redis
->
auth
(
$conf
[
'password'
]);
}
//ini_set('default_socket_timeout', -1);(所有长连接不超时)
$redis
->
setOption
(
Redis
::
OPT_READ_TIMEOUT
,
-
1
);
$result
=
$redis
->
subscribe
(
array
(
'redisPublish'
),
'callback'
);
function
printTest
(
$meg
){
echo
$meg
.
'213'
;
}
function
callback
(
$instance
,
$channelName
,
$message
){
printTest
(
$message
);
}
}
private
function
stop
()
{
if
(
file_exists
(
$this
->
pidfile
))
{
$pid
=
file_get_contents
(
$this
->
pidfile
);
posix_kill
(
$pid
,
9
);
unlink
(
$this
->
pidfile
);
}
}
private
function
help
(
$proc
)
{
printf
(
"%s start | stop | help
\n
"
,
$proc
);
}
public
function
main
(
$argv
)
{
if
(
count
(
$argv
)
<
2
)
{
printf
(
"please input help parameter
\n
"
);
exit
();
}
if
(
$argv
[
1
]
===
'stop'
)
{
$this
->
stop
();
}
else
if
(
$argv
[
1
]
===
'start'
)
{
$this
->
start
();
}
else
{
$this
->
help
(
$argv
[
0
]);
}
}
}
$cgse
=
new
runRedisPush
();
$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