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
91edb697
Commit
91edb697
authored
Oct 09, 2018
by
zhz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
salemonth
parent
0e7e5445
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
10 deletions
+21
-10
GoodsCommonService.php
application/models/Business/Goods/GoodsCommonService.php
+2
-2
Order.php
application/models/DAO/Order/Order.php
+6
-2
storeMonthSales.php
scripts/crontab/store/storeMonthSales.php
+13
-6
No files found.
application/models/Business/Goods/GoodsCommonService.php
View file @
91edb697
...
@@ -929,8 +929,8 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
...
@@ -929,8 +929,8 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$orderDAO
=
\DAO\Order\OrderModel
::
getInstance
();
$orderDAO
=
\DAO\Order\OrderModel
::
getInstance
();
$goodsCommonDAO
=
\DAO\GoodsCommonModel
::
getInstance
();
$goodsCommonDAO
=
\DAO\GoodsCommonModel
::
getInstance
();
$goodsCommonRedis
=
\Redis\Db4\GoodsCommonRedisModel
::
getInstance
();
$goodsCommonRedis
=
\Redis\Db4\GoodsCommonRedisModel
::
getInstance
();
$page
Size
=
1000
;
$page
Index
=
\Our\PageConst
::
taskPageBegin
;
$page
Index
=
0
;
$page
Size
=
\Our\PageConst
::
taskPageSize
;
$storeIds
=
$storeDAO
->
getOnlineStores
(
null
,
'store_id'
);
$storeIds
=
$storeDAO
->
getOnlineStores
(
null
,
'store_id'
);
while
(
true
)
{
while
(
true
)
{
$limit
=
array
(
$pageIndex
*
$pageSize
,
$pageSize
);
$limit
=
array
(
$pageIndex
*
$pageSize
,
$pageSize
);
...
...
application/models/DAO/Order/Order.php
View file @
91edb697
...
@@ -69,10 +69,14 @@ class OrderModel extends \DAO\AbstractModel
...
@@ -69,10 +69,14 @@ class OrderModel extends \DAO\AbstractModel
return
$this
->
db
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
fetchNum
();
return
$this
->
db
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
fetchNum
();
}
}
public
function
getCounts
(
$where
,
$field
,
$group
=
false
)
public
function
getCounts
(
$where
,
$field
,
$group
=
false
,
$limit
=
[]
)
{
{
$this
->
setDb
();
$this
->
setDb
();
return
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
group
(
$group
)
->
fetchAll
();
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
group
(
$group
);
if
(
$limit
)
{
$this
->
db
->
limit
(
$limit
[
0
],
$limit
[
1
]);
}
return
$this
->
db
->
fetchAll
();
}
}
public
function
getOrderCounts
(
$where
,
$field
)
public
function
getOrderCounts
(
$where
,
$field
)
...
...
scripts/crontab/store/storeMonthSales.php
100755 → 100644
View file @
91edb697
...
@@ -6,11 +6,18 @@
...
@@ -6,11 +6,18 @@
*/
*/
define
(
"APPLICATION_PATH"
,
realpath
(
dirname
(
__FILE__
)
.
'/../../../'
));
//指向public的上一级
define
(
"APPLICATION_PATH"
,
realpath
(
dirname
(
__FILE__
)
.
'/../../../'
));
//指向public的上一级
require
APPLICATION_PATH
.
'/scripts/crontab/common.php'
;
require
APPLICATION_PATH
.
'/scripts/crontab/common.php'
;
$data
=
\DAO\Order\OrderModel
::
getInstance
()
->
getCounts
(
'payment_time >= '
.
(
time
()
-
30
*
24
*
60
*
60
),
'count(order_id) as num,store_id'
,
'store_id'
);
$pageIndex
=
\Our\PageConst
::
taskPageBegin
;
$pageSize
=
\Our\PageConst
::
taskPageSize
;
do
{
$limit
=
array
(
$pageIndex
*
$pageSize
,
$pageSize
);
$data
=
\DAO\Order\OrderModel
::
getInstance
()
->
getCounts
(
'payment_time >= '
.
(
time
()
-
30
*
24
*
60
*
60
),
'count(order_id) as num,store_id'
,
'store_id'
,
$limit
);
//$data = \DAO\Order\OrderModel::getInstance()->getCounts('payment_time >= 1518303150','store_id,count(order_id) as num','store_id');
//$data = \DAO\Order\OrderModel::getInstance()->getCounts('payment_time >= 1518303150','store_id,count(order_id) as num','store_id');
if
(
$data
){
if
(
$data
){
foreach
(
$data
as
&
$v
){
foreach
(
$data
as
&
$v
){
$v
[
'updatetime'
]
=
time
();
$v
[
'updatetime'
]
=
time
();
}
}
\DAO\StoreMonthSalesModel
::
getInstance
()
->
insertAllOrUpdate
(
$data
);
\DAO\StoreMonthSalesModel
::
getInstance
()
->
insertAllOrUpdate
(
$data
);
}
}
$pageIndex
++
;
}
while
(
!
empty
(
$data
));
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