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
fc94ffd1
Commit
fc94ffd1
authored
Nov 03, 2018
by
wwccw0591
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cronab
parent
a91837d9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
8 deletions
+25
-8
ApiConst.php
application/library/Our/ApiConst.php
+2
-2
GoodsCommonService.php
application/models/Business/Goods/GoodsCommonService.php
+9
-0
Goods.php
application/models/DAO/Goods.php
+3
-0
jpush.php
scripts/crontab/push/jpush.php
+11
-6
No files found.
application/library/Our/ApiConst.php
View file @
fc94ffd1
...
@@ -23,7 +23,7 @@ class ApiConst
...
@@ -23,7 +23,7 @@ class ApiConst
const
oneHour
=
3600
;
const
oneHour
=
3600
;
//预警时间
//预警时间
const
storageAlarmHour
=
10
8
00
;
const
storageAlarmHour
=
10
00000000000
00
;
const
twoMinSecond
=
120
;
const
twoMinSecond
=
120
;
...
@@ -420,7 +420,7 @@ class ApiConst
...
@@ -420,7 +420,7 @@ class ApiConst
const
messageRefundProccessing
=
104
;
const
messageRefundProccessing
=
104
;
//售后待收货
//售后待收货
const
messageRefundWaitReceive
=
105
;
const
messageRefundWaitReceive
=
105
;
//
用户被其它用户登录请退出
//
预警商品数量
const
messageGoodsAlert
=
106
;
const
messageGoodsAlert
=
106
;
//用户被其它用户登录请退出
//用户被其它用户登录请退出
const
messageOtherLogin
=
107
;
const
messageOtherLogin
=
107
;
...
...
application/models/Business/Goods/GoodsCommonService.php
View file @
fc94ffd1
...
@@ -1314,4 +1314,13 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
...
@@ -1314,4 +1314,13 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
}
}
public
function
getGoodsCount
(
$storeIds
){
$goodsDao
=
\DAO\GoodsModel
::
getInstance
();
$storeIds
=
implode
(
','
,
$storeIds
);
$where
=
Common
::
format
(
" store_id in(
{
0
}
) and goods_storage<goods_storage_alarm"
,
$storeIds
);
$stores
=
$goodsDao
->
getListGroup
(
$where
,
"store_id as storeId,count(*) as count"
,
"store_id"
);
return
$stores
;
}
}
}
application/models/DAO/Goods.php
View file @
fc94ffd1
...
@@ -75,6 +75,9 @@ class GoodsModel extends \DAO\AbstractModel {
...
@@ -75,6 +75,9 @@ class GoodsModel extends \DAO\AbstractModel {
}
}
public
function
getListGroup
(
$where
,
$field
,
$groupField
){
public
function
getListGroup
(
$where
,
$field
,
$groupField
){
$this
->
setDb
(
$this
->
dbName
);
$this
->
setDb
(
$this
->
dbName
);
if
(
is_array
(
$where
)){
$where
=
$this
->
db
->
getSqlWhereByArray
(
$where
);
}
return
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
group
(
$groupField
)
->
fetchAll
();
return
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
group
(
$groupField
)
->
fetchAll
();
}
}
// public function getOneById($id){
// public function getOneById($id){
...
...
scripts/crontab/push/jpush.php
View file @
fc94ffd1
...
@@ -85,14 +85,19 @@ class cliOrderClose extends basecli
...
@@ -85,14 +85,19 @@ class cliOrderClose extends basecli
$push
->
addOneToClient
(
$addData
);
$push
->
addOneToClient
(
$addData
);
}
}
$goodsCommonService
=
\Business\Goods\GoodsCommonServiceModel
::
getInstance
();
$goodsCommonService
=
\Business\Goods\GoodsCommonServiceModel
::
getInstance
();
$stores
=
$goodsCommonService
->
getAlertGoods
();
$storesBase
=
$goodsCommonService
->
getAlertGoods
();
if
(
!
empty
(
$stores
)){
if
(
$storesBase
){
foreach
(
$stores
as
$store
){
$storesIds
=
array_column
(
$storesBase
,
'storeId'
);
$addData
=
array
(
'storeId'
=>
$store
[
'storeId'
],
'type'
=>
\Our\ApiConst
::
messageGoodsAlert
,
'op'
=>
\Our\NameConst
::
set
,
'num'
=>
$store
[
'count'
],
'params'
=>
array
());
$stores
=
$goodsCommonService
->
getGoodsCount
(
$storesIds
);
$push
->
addOneToClient
(
$addData
);
if
(
!
empty
(
$stores
)){
}
foreach
(
$stores
as
$store
){
$addData
=
array
(
'storeId'
=>
$store
[
'storeId'
],
'type'
=>
\Our\ApiConst
::
messageGoodsAlert
,
'op'
=>
\Our\NameConst
::
set
,
'num'
=>
$store
[
'count'
],
'params'
=>
array
());
$push
->
addOneToClient
(
$addData
);
}
}
}
}
$push
->
sendTcpMessage
();
$push
->
sendTcpMessage
();
$redis
->
close
();
$redis
->
close
();
}
}
...
...
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