Commit 43f42c9c authored by wwccw0591's avatar wwccw0591

pc

parent 61881115
...@@ -479,6 +479,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -479,6 +479,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
public function insertStoreMemberStatics() public function insertStoreMemberStatics()
{ {
$orderGoodDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName); $orderGoodDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName);
$orderDao=\DAO\Order\OrderModel::getInstance();
$storeMemberStatisticDao = \DAO\StoreMemberStatisticsModel::getInstance(DbNameConst::masterDBConnectName); $storeMemberStatisticDao = \DAO\StoreMemberStatisticsModel::getInstance(DbNameConst::masterDBConnectName);
$gmtCreate = file_get_contents($this->baseDir . PathConst::orderGoodsCreateTime); $gmtCreate = file_get_contents($this->baseDir . PathConst::orderGoodsCreateTime);
$gmtCreate = $gmtCreate ? $gmtCreate : ApiConst::zero; $gmtCreate = $gmtCreate ? $gmtCreate : ApiConst::zero;
...@@ -489,6 +490,13 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -489,6 +490,13 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$addDatas = array(); $addDatas = array();
$storeMemberStatisticData = $orderGoodDao->getMemberStoreStaticsByCreateTime($beginTime, $this->taskIndex, $this->taskSize); $storeMemberStatisticData = $orderGoodDao->getMemberStoreStaticsByCreateTime($beginTime, $this->taskIndex, $this->taskSize);
$storeMemberStatisticData = isset($storeMemberStatisticData['list']) ? $storeMemberStatisticData['list'] : false; $storeMemberStatisticData = isset($storeMemberStatisticData['list']) ? $storeMemberStatisticData['list'] : false;
$orderIds=array_column($storeMemberStatisticData,'orderId');
array_unique($orderIds);
if(!empty($orderIds)){
$orders=$orderDao->getByOrderId($orderIds,'order_amount as orderAmount,order_id as orderId','orderId');
}else{
$orders=[];
}
if ($storeMemberStatisticData) { if ($storeMemberStatisticData) {
$this->taskIndex++; $this->taskIndex++;
foreach ($storeMemberStatisticData as $value) { foreach ($storeMemberStatisticData as $value) {
...@@ -500,9 +508,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -500,9 +508,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderGoodsCount'] = $value['goodsNum']; $addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderGoodsCount'] = $value['goodsNum'];
} }
if (isset($addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderTotal'])) { if (isset($addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderTotal'])) {
$addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderTotal'] += $value['goodsPrice']; // $addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderTotal'] += $value['goodsPrice'];
$addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderTotal'] +=$orders[$value['orderId']]['orderAmount'];
} else { } else {
$addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderTotal'] = $value['goodsPrice']; $addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderTotal'] = $orders[$value['orderId']]['orderAmount'];
} }
} }
} }
......
This diff is collapsed.
...@@ -17,7 +17,7 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -17,7 +17,7 @@ class OrderGoodsModel extends \DAO\AbstractModel {
* @var string * @var string
*/ */
protected $_tableName = 'han_order_goods'; protected $_tableName = 'han_order_goods';
public $sumField="rec_id,store_id as storeId,buyer_id as buyerId,goods_num as goodsNum,goods_price as goodsPrice,gmt_create as gmtCreate"; public $sumField="rec_id,store_id as storeId,buyer_id as buyerId,goods_num as goodsNum,goods_price as goodsPrice,gmt_create as gmtCreate,order_id as orderId";
public $groupField=array('buyer_id','store_id'); public $groupField=array('buyer_id','store_id');
public $orderGoodsField = "order_id as orderId,rec_id as recId,goods_id as goodsId,goods_name as goodsName,goods_price as goodsPrice,goods_num as goodsNum,goods_image as goodsImage,goods_pay_price as goodsPayPrice,sale_act_id as saleActId,sale_id as saleId,comment_state as commentState,is_refund as isRefund,goods_spec as goodsSpec,refund_state_name as refundStateName,refund_id as refundId"; public $orderGoodsField = "order_id as orderId,rec_id as recId,goods_id as goodsId,goods_name as goodsName,goods_price as goodsPrice,goods_num as goodsNum,goods_image as goodsImage,goods_pay_price as goodsPayPrice,sale_act_id as saleActId,sale_id as saleId,comment_state as commentState,is_refund as isRefund,goods_spec as goodsSpec,refund_state_name as refundStateName,refund_id as refundId";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment