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
1de03588
Commit
1de03588
authored
Aug 24, 2018
by
zhz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into master_dev
parents
bfd6759f
ab962316
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
82 additions
and
7 deletions
+82
-7
ApiConst.php
application/library/Our/ApiConst.php
+2
-2
NameConst.php
application/library/Our/NameConst.php
+3
-0
ShopkeeperService.php
application/models/Business/Store/ShopkeeperService.php
+24
-3
Member.php
application/models/DAO/Member.php
+0
-2
Order.php
application/models/DAO/Order/Order.php
+19
-0
StoreStatisticsDay.php
application/models/DAO/Store/StoreStatisticsDay.php
+34
-0
No files found.
application/library/Our/ApiConst.php
View file @
1de03588
...
@@ -11,8 +11,8 @@ class ApiConst
...
@@ -11,8 +11,8 @@ class ApiConst
const
randLengh
=
8
;
const
randLengh
=
8
;
//10天数秒
//10天数秒
// const tenDaySecond = 8640
00;
const
tenDaySecond
=
864
00
;
const
tenDaySecond
=
300
;
//
const tenDaySecond = 300;
//一天
//一天
const
oneDaySecond
=
86400
;
const
oneDaySecond
=
86400
;
//半天
//半天
...
...
application/library/Our/NameConst.php
View file @
1de03588
...
@@ -153,6 +153,9 @@ class NameConst {
...
@@ -153,6 +153,9 @@ class NameConst {
const
elasticName
=
'elastic.master'
;
const
elasticName
=
'elastic.master'
;
const
shopkeeper
=
'shopkeeper'
;
const
shopkeeper
=
'shopkeeper'
;
const
cancelUnPayedOrderTimePrefix
=
'cancelUnPayedOrderTime'
;
const
cancelUnReceivedOrderTimePrefix
=
'cancelUnReceivedOrderTime'
;
}
}
?>
?>
\ No newline at end of file
application/models/Business/Store/ShopkeeperService.php
View file @
1de03588
...
@@ -394,7 +394,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
...
@@ -394,7 +394,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$orderDao
=
\DAO\Order\OrderModel
::
getInstance
(
DbNameConst
::
salveDBConnectName
);
$orderDao
=
\DAO\Order\OrderModel
::
getInstance
(
DbNameConst
::
salveDBConnectName
);
$res
=
file_get_contents
(
$this
->
baseDir
.
PathConst
::
orderPaymentTimeConf
);
$res
=
file_get_contents
(
$this
->
baseDir
.
PathConst
::
orderPaymentTimeConf
);
$this
->
lastOrderId
=
!
empty
(
$res
)
?
$res
:
ApiConst
::
zero
;
$this
->
lastOrderId
=
!
empty
(
$res
)
?
$res
:
ApiConst
::
zero
;
$where
[
'payment_time'
]
=
Common
::
format
(
" payment_time >
{
0
}
and payment
_time <=
{
1
}
"
,
$this
->
lastOrderId
,
TIMESTAMP
);
$where
=
Common
::
format
(
" add_time >
{
0
}
and add
_time <=
{
1
}
"
,
$this
->
lastOrderId
,
TIMESTAMP
);
$res
=
$orderDao
->
getAllByWhere
(
$where
,
$orderDao
->
getOrderDetailField
());
$res
=
$orderDao
->
getAllByWhere
(
$where
,
$orderDao
->
getOrderDetailField
());
$results
=
array
();
$results
=
array
();
if
(
!
empty
(
$res
))
{
if
(
!
empty
(
$res
))
{
...
@@ -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
);
...
@@ -508,7 +530,6 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
...
@@ -508,7 +530,6 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
//店铺订单统计任务脚本
//店铺订单统计任务脚本
public
function
storeStatictisTask
()
public
function
storeStatictisTask
()
{
{
$orderTotals
=
$this
->
getOrderTotal
();
$orderTotals
=
$this
->
getOrderTotal
();
$memberTotals
=
$this
->
getMemberTotal
();
$memberTotals
=
$this
->
getMemberTotal
();
$storeStatisticsDayDao
=
\DAO\Store\StoreStatisticsDayModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$storeStatisticsDayDao
=
\DAO\Store\StoreStatisticsDayModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
...
...
application/models/DAO/Member.php
View file @
1de03588
...
@@ -335,8 +335,6 @@ class MemberModel extends \DAO\AbstractModel
...
@@ -335,8 +335,6 @@ class MemberModel extends \DAO\AbstractModel
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
wrongMobileFormat
);
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
wrongMobileFormat
);
}
}
$member
=
$this
->
getOneByWhereWithField
(
array
(
'member_mobile'
=>
$mobile
),
'member_id'
);
$member
=
$this
->
getOneByWhereWithField
(
array
(
'member_mobile'
=>
$mobile
),
'member_id'
);
\Our\Log
::
getInstance
()
->
write
(
$this
->
db
->
getLastSql
());
\Our\Log
::
getInstance
()
->
write
(
json_encode
(
$member
,
true
));
if
(
$member
)
{
if
(
$member
)
{
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
registerMobileExist
);
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
registerMobileExist
);
}
}
...
...
application/models/DAO/Order/Order.php
View file @
1de03588
...
@@ -710,6 +710,7 @@ class OrderModel extends \DAO\AbstractModel
...
@@ -710,6 +710,7 @@ class OrderModel extends \DAO\AbstractModel
$this
->
deleteFindByOrderIdCache
(
$orderId
);
$this
->
deleteFindByOrderIdCache
(
$orderId
);
$orderGoodsDao
=
\DAO\Order\OrderGoodsModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$orderGoodsDao
=
\DAO\Order\OrderGoodsModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$orderGoodsDao
->
deleteOrderGoodsCache
(
$memberId
,
$orderId
);
$orderGoodsDao
->
deleteOrderGoodsCache
(
$memberId
,
$orderId
);
\DAO\MemberModel
::
getInstance
()
->
deleteTotalCache
(
$memberId
);
}
}
}
}
...
@@ -835,6 +836,24 @@ class OrderModel extends \DAO\AbstractModel
...
@@ -835,6 +836,24 @@ class OrderModel extends \DAO\AbstractModel
}
}
return
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
fetchAll
();
return
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
fetchAll
();
}
}
public
function
updateCancelUnpayedOrderTimeCache
(
$time
){
\Redis\Db5\OrderRedisModel
::
getInstance
()
->
update
(
\Our\NameConst
::
cancelUnPayedOrderTimePrefix
,
$time
);
}
public
function
getCancelUnpayedOrderTimeCache
(){
\Redis\Db5\OrderRedisModel
::
getInstance
()
->
tableCacheGet
(
\Our\NameConst
::
cancelUnPayedOrderTimePrefix
);
}
public
function
updateCancelUnReceivedOrderTimeCache
(
$time
){
\Redis\Db5\OrderRedisModel
::
getInstance
()
->
update
(
\Our\NameConst
::
cancelUnReceivedOrderTimePrefix
,
$time
);
}
public
function
getCancelUnReceivedOrderTimeCache
(){
\Redis\Db5\OrderRedisModel
::
getInstance
()
->
tableCacheGet
(
\Our\NameConst
::
cancelUnReceivedOrderTimePrefix
);
}
/**
/**
* 类实例
* 类实例
*
*
...
...
application/models/DAO/Store/StoreStatisticsDay.php
View file @
1de03588
...
@@ -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