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
ab962316
Commit
ab962316
authored
Aug 24, 2018
by
liuyuzhen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into lyz
parents
aa013a1f
62eb144e
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
366 deletions
+57
-366
ApiConst.php___jb_old___
application/library/Our/ApiConst.php___jb_old___
+0
-365
ShopkeeperService.php
application/models/Business/Store/ShopkeeperService.php
+23
-1
StoreStatisticsDay.php
application/models/DAO/Store/StoreStatisticsDay.php
+34
-0
No files found.
application/library/Our/ApiConst.php___jb_old___
deleted
100644 → 0
View file @
aa013a1f
This diff is collapsed.
Click to expand it.
application/models/Business/Store/ShopkeeperService.php
View file @
ab962316
...
@@ -417,7 +417,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
...
@@ -417,7 +417,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$favoritesStoreDao
=
\DAO\FavoritesStoreModel
::
getInstance
();
$favoritesStoreDao
=
\DAO\FavoritesStoreModel
::
getInstance
();
$res
=
file_get_contents
(
$this
->
baseDir
.
PathConst
::
favoritesStoreFavTimeConf
);
$res
=
file_get_contents
(
$this
->
baseDir
.
PathConst
::
favoritesStoreFavTimeConf
);
$this
->
lastFavId
=
!
empty
(
$res
)
?
$res
:
ApiConst
::
zero
;
$this
->
lastFavId
=
!
empty
(
$res
)
?
$res
:
ApiConst
::
zero
;
$where
[
'fav_time'
]
=
Common
::
format
(
"fav_time >=
{
0
}
and fav_time <
{
1
}
"
,
$this
->
lastFavId
,
TIMESTAMP
);
$where
=
Common
::
format
(
"fav_time >=
{
0
}
and fav_time <
{
1
}
"
,
$this
->
lastFavId
,
TIMESTAMP
);
$res
=
$favoritesStoreDao
->
getAllByWhere
(
$where
,
$favoritesStoreDao
->
favoriteMemberCountField
);
$res
=
$favoritesStoreDao
->
getAllByWhere
(
$where
,
$favoritesStoreDao
->
favoriteMemberCountField
);
$results
=
array
();
$results
=
array
();
if
(
!
empty
(
$res
))
{
if
(
!
empty
(
$res
))
{
...
@@ -468,12 +468,33 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
...
@@ -468,12 +468,33 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
}
while
(
$storeMemberStatisticData
);
}
while
(
$storeMemberStatisticData
);
file_put_contents
(
$this
->
baseDir
.
PathConst
::
orderGoodsCreateTime
,
TIMESTAMP
);
file_put_contents
(
$this
->
baseDir
.
PathConst
::
orderGoodsCreateTime
,
TIMESTAMP
);
}
public
function
reduceRefundModel
(
$storeMemberDatas
){
$convertStoreMember
=
array
();
if
(
$storeMemberDatas
){
foreach
(
$storeMemberDatas
as
$order
){
if
(
isset
(
$convertStoreMember
[
$order
[
'storeId'
]])){
$convertStoreMember
[
$order
[
'storeId'
]][
'orderCount'
]
=
$convertStoreMember
[
$order
[
'storeId'
]][
'orderCount'
]
-
ApiConst
::
one
;
$convertStoreMember
[
$order
[
'storeId'
]][
'orderTotal'
]
=
$convertStoreMember
[
$order
[
'storeId'
]][
'orderTotal'
]
+
$order
[
'refundAmount'
];
}
else
{
$convertStoreMember
[
$order
[
'storeId'
]][
'orderCount'
]
=
ApiConst
::
one
;
$convertStoreMember
[
$order
[
'storeId'
]][
'orderTotal'
]
=
$order
[
'refundAmount'
];
$convertStoreMember
[
$order
[
'storeId'
]][
'gmtCreate'
]
=
isset
(
$order
[
'gmtUpdate'
])
?
date
(
$order
[
'gmtUpdate'
])
:
date
(
'Y-m-d'
,
TIMESTAMP
);
}
}
$convertStoreMember
=
array_values
(
$convertStoreMember
);
$storeStatisticDayDao
=
\DAO\Store\StoreStatisticsDayModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$storeStatisticDayDao
->
addAllReduce
(
$convertStoreMember
);
}
}
}
//任务脚本
//任务脚本
public
function
reduceStoreMemberStatics
()
public
function
reduceStoreMemberStatics
()
{
{
$refundReturnDao
=
\DAO\Order\RefundReturnModel
::
getInstance
(
DbNameConst
::
salveDBConnectName
);
$refundReturnDao
=
\DAO\Order\RefundReturnModel
::
getInstance
(
DbNameConst
::
salveDBConnectName
);
$storeMemberStatisticDao
=
\DAO\StoreMemberStatisticsModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$storeMemberStatisticDao
=
\DAO\StoreMemberStatisticsModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$gmtUpdate
=
file_get_contents
(
$this
->
baseDir
.
PathConst
::
refundRetrunGmtUpdate
);
$gmtUpdate
=
file_get_contents
(
$this
->
baseDir
.
PathConst
::
refundRetrunGmtUpdate
);
$gmtUpdate
=
$gmtUpdate
?
$gmtUpdate
:
ApiConst
::
zero
;
$gmtUpdate
=
$gmtUpdate
?
$gmtUpdate
:
ApiConst
::
zero
;
$this
->
taskIndex
=
PageConst
::
taskPageBegin
;
$this
->
taskIndex
=
PageConst
::
taskPageBegin
;
...
@@ -501,6 +522,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
...
@@ -501,6 +522,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
}
}
$addDatas
=
array_values
(
$addDatas
);
$addDatas
=
array_values
(
$addDatas
);
$storeMemberStatisticDao
->
addAllReduce
(
$addDatas
);
$storeMemberStatisticDao
->
addAllReduce
(
$addDatas
);
$this
->
reduceRefundModel
(
$storeMemberStatisticData
);
}
while
(
$storeMemberStatisticData
);
}
while
(
$storeMemberStatisticData
);
file_put_contents
(
$this
->
baseDir
.
PathConst
::
refundRetrunGmtUpdate
,
TIMESTAMP
);
file_put_contents
(
$this
->
baseDir
.
PathConst
::
refundRetrunGmtUpdate
,
TIMESTAMP
);
...
...
application/models/DAO/Store/StoreStatisticsDay.php
View file @
ab962316
...
@@ -113,6 +113,40 @@ class StoreStatisticsDayModel extends \DAO\AbstractModel {
...
@@ -113,6 +113,40 @@ class StoreStatisticsDayModel extends \DAO\AbstractModel {
}
}
}
}
//插入数据大量
//插入数据大量
public
function
addAllReduce
(
$datas
)
{
$this
->
setDb
(
DbNameConst
::
masterDBConnectName
);
$error
=
0
;
$baseSql
=
"insert into
{
$this
->
_tableName
}
(store_id,order_count,order_total,gmt_create) values"
;
$extentSql
=
" ON DUPLICATE KEY UPDATE order_count=order_goods_count-values(order_goods_count),order_total=order_total-values(order_total)"
;
$insertAllSql
=
$baseSql
;
for
(
$i
=
0
;
$i
<
count
(
$datas
);
$i
++
)
{
$addSql
=
\Our\Common
::
format
(
"(
{
0},{1},{2},{3
}
),"
,
$datas
[
$i
][
'storeId'
],
$datas
[
$i
][
'orderCount'
],
$datas
[
$i
][
'orderTotal'
],
datas
[
$i
][
'gmtCreate'
]);
$insertAllSql
.=
$addSql
;
if
(
$i
%
1000
==
0
&&
$i
!=
0
)
{
$insertAllSql
=
rtrim
(
$insertAllSql
,
','
);
$insertSql
=
$insertAllSql
.
$extentSql
;
$one
=
$this
->
db
->
insert
(
$this
->
_tableName
)
->
query
(
$insertSql
);
if
(
!
$one
)
{
$error
++
;
}
$insertAllSql
=
$baseSql
;
}
}
if
(
$insertAllSql
!=
$baseSql
)
{
$insertAllSql
=
rtrim
(
$insertAllSql
,
','
);
$insertSql
=
$insertAllSql
.
$extentSql
;
$one
=
$this
->
db
->
insert
(
$this
->
_tableName
)
->
query
(
$insertSql
);
if
(
!
$one
)
{
$error
++
;
}
}
if
(
$error
>
0
)
{
$dataJson
=
json_encode
(
$datas
);
throw
new
Exception
(
'插入han_store_member_statistics失败,'
.
$dataJson
,
4
);
}
}
//插入数据大量
public
function
addAll
(
$datas
)
public
function
addAll
(
$datas
)
{
{
$this
->
setDb
(
DbNameConst
::
masterDBConnectName
);
$this
->
setDb
(
DbNameConst
::
masterDBConnectName
);
...
...
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