Commit 43f42c9c authored by wwccw0591's avatar wwccw0591

pc

parent 61881115
......@@ -479,6 +479,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
public function insertStoreMemberStatics()
{
$orderGoodDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName);
$orderDao=\DAO\Order\OrderModel::getInstance();
$storeMemberStatisticDao = \DAO\StoreMemberStatisticsModel::getInstance(DbNameConst::masterDBConnectName);
$gmtCreate = file_get_contents($this->baseDir . PathConst::orderGoodsCreateTime);
$gmtCreate = $gmtCreate ? $gmtCreate : ApiConst::zero;
......@@ -489,6 +490,13 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$addDatas = array();
$storeMemberStatisticData = $orderGoodDao->getMemberStoreStaticsByCreateTime($beginTime, $this->taskIndex, $this->taskSize);
$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) {
$this->taskIndex++;
foreach ($storeMemberStatisticData as $value) {
......@@ -500,9 +508,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderGoodsCount'] = $value['goodsNum'];
}
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 {
$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 {
* @var string
*/
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 $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