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
9e150f7d
Commit
9e150f7d
authored
Dec 12, 2018
by
christ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pc
parent
d8a06c7c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
26 deletions
+26
-26
ShopkeeperService.php
application/models/Business/Store/ShopkeeperService.php
+18
-16
StoreMemberStatistics.php
application/models/DAO/StoreMemberStatistics.php
+6
-8
index.php
scripts/crontab/shopkeeper/index.php
+2
-2
No files found.
application/models/Business/Store/ShopkeeperService.php
View file @
9e150f7d
...
...
@@ -668,14 +668,12 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$orders
=
isset
(
$storeMemberStatisticDatas
[
'list'
])
?
$storeMemberStatisticDatas
[
'list'
]
:
false
;
$this
->
taskIndex
++
;
if
(
$orders
)
{
$i
=
0
;
foreach
(
$orders
as
$order
){
$storeMemberStatisticsData
[
'storeId'
]
=
$order
[
'storeId'
];
$storeMemberStatisticsData
[
'buyerId'
]
=
$order
[
'buyerId'
];
$orderRes
=
$orderDao
->
getSumAmountCountByMemberIdAndStoreId
(
$storeMemberStatisticsData
[
'storeId'
],
$storeMemberStatisticsData
[
'buyerId'
]);
$storeMemberStatisticsData
[
'orderTotal'
]
=
$orderRes
[
'orderTotal'
]
?
$orderRes
[
'orderTotal'
]
:
ApiConst
::
zero
;
$orderGoodsRes
=
$orderGoodDao
->
getOrderGoodsCountBuyStoreIdAndMemberId
(
$storeMemberStatisticsData
[
'storeId'
],
$storeMemberStatisticsData
[
'buyerId'
]);
echo
$i
++
;
echo
"
\r\n
"
;
$orderGoodsCount
=
$orderGoodsRes
?
$orderGoodsRes
[
'orderGoodsCount'
]
:
ApiConst
::
zero
;
$storeMemberStatisticsData
[
'orderGoodsCount'
]
=
$orderGoodsCount
;
$storeMemberStatisticsData
[
'addTime'
]
=
TIMESTAMP
;
...
...
@@ -685,13 +683,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
echo
$ex
->
getMessage
()
.
json_encode
(
$storeMemberStatisticsData
)
.
"
\r\n
"
;
}
}
echo
4
;
}
echo
5
;
echo
$this
->
taskIndex
;
echo
6
;
}
while
(
$orders
);
echo
234234
;
exit
;
file_put_contents
(
$this
->
baseDir
.
PathConst
::
orderGoodsCreateTime
,
TIMESTAMP
);
}
//任务脚本原来的方法是下面那个
...
...
@@ -912,20 +905,29 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
if
(
!
empty
(
$refundReturns
))
{
foreach
(
$refundReturns
as
$refundReturn
)
{
$orderDao
->
deleteOrderCache
(
$refundReturn
[
'buyerId'
],
$refundReturn
[
'orderId'
],
$refundReturn
[
'storeId'
],
true
,
true
);
$res
=
$orderGoodsDao
->
find
(
array
(
'order_id'
=>
$refundReturn
[
'orderId'
],
'refund_id'
=>
ApiConst
::
zero
));
if
(
empty
(
$res
))
{
$reduceData
[
'store_id'
]
=
$refundReturn
[
'storeId'
];
$reduceData
[
'memb
er_id'
]
=
$refundReturn
[
'buyerId'
];
$reduceData
[
'buy
er_id'
]
=
$refundReturn
[
'buyerId'
];
$reduceData
[
'order_goods_count'
]
=
ApiConst
::
zero
;
$reduceData
[
'order_total'
]
=
$refundReturn
[
'orderAmount'
];
$reduceData
[
'addTime'
]
=
TIMESTAMP
;
array_push
(
$reduceDatas
,
$reduceData
);
$reduceData
[
'order_total'
]
=
$refundReturn
[
'refundAmount'
];
$reduceData
[
'add_time'
]
=
TIMESTAMP
;
$where
[
'store_id'
]
=
$reduceData
[
'storeId'
];
$where
[
'buyer_id'
]
=
$reduceData
[
'buyerId'
];
$originOne
=
$storeMemberStatisticDao
->
find
(
$where
);
echo
json_encode
(
$originOne
);
exit
;
if
(
!
empty
(
$originOne
)){
$originOne
[
'order_total'
]
=
$originOne
[
'order_total'
]
-
$reduceData
[
'orderTotal'
];
$originOne
[
'add_time'
]
=
TIMESTAMP
;
echo
json_encode
(
$originOne
);
exit
;
$storeMemberStatisticDao
->
update
(
$originOne
,
$where
);
}
else
{
$storeMemberStatisticDao
->
insert
(
$reduceData
,
$where
);
}
}
}
}
while
(
$refundReturns
);
$storeMemberStatisticDao
->
addAllReduce
(
$refundReturns
);
//
$storeMemberStatisticDao->addAllReduce($refundReturns);
file_put_contents
(
$this
->
baseDir
.
PathConst
::
refundRetrunGmtUpdate
,
TIMESTAMP
);
}
...
...
application/models/DAO/StoreMemberStatistics.php
View file @
9e150f7d
...
...
@@ -55,18 +55,15 @@ class StoreMemberStatisticsModel extends \DAO\AbstractModel {
* @return mixed
*/
public
function
update
(
$data
,
$where
){
$this
->
setDb
();
$this
->
setDb
(
DbNameConst
::
masterDBConnectName
);
return
$this
->
db
->
update
(
$this
->
_tableName
)
->
where
(
$where
)
->
rows
(
$data
)
->
execute
();
}
/**
* 插入数据
* @param $data
* @return mixed
*/
public
function
insert
(
$data
){
$this
->
setDb
(
DbNameConst
::
masterDBConnectName
);
return
$this
->
db
->
insert
(
$this
->
_tableName
)
->
rows
(
$data
)
->
execute
();
}
/**
* 排序,1:关注时间降序,2:关注时间升序,3:购买力降序,4:购买力升序,默认1
* @param $data
...
...
@@ -168,6 +165,7 @@ class StoreMemberStatisticsModel extends \DAO\AbstractModel {
}
return
$result
;
}
//插入数据大量
public
function
addOrUpdate
(
$data
)
{
...
...
scripts/crontab/shopkeeper/index.php
View file @
9e150f7d
...
...
@@ -70,9 +70,9 @@ class cliShopkeeperIndex extends basecli
$shopkeeperService
=
\Business\Store\ShopkeeperServiceModel
::
getInstance
();
$shopkeeperService
->
baseDir
=
\Our\Common
::
getConfig
(
'out.config'
);
try
{
$shopkeeperService
->
insertStoreMemberStatics
();
//
$shopkeeperService->insertStoreMemberStatics();
//退货退款订单自动关闭
//
$shopkeeperService->reduceStoreMemberStatics();
$shopkeeperService
->
reduceStoreMemberStatics
();
//$shopkeeperService->storeStatictisTask();
// $shopkeeperService->updateLastId();
}
catch
(
Exception
$ex
)
{
...
...
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