Commit faaa7f73 authored by christ's avatar christ

storage

parent a5cb9817
<?php
namespace Our;
use OSS\Common;
/**
* 控制器抽象类
......
......@@ -181,7 +181,7 @@ class NameConst {
const logOut='logOut';
const versionOne = '1.0.1';
const versionOne = '1.0.0';
const versionDefault = '1.0';
......
......@@ -649,8 +649,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
}
return $results;
}
//任务脚本原来的方法是下面那个
//任务脚本原来的方法是下面那个
public function insertStoreMemberStatics()
{
$orderGoodDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName);
......@@ -696,6 +695,52 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
file_put_contents($this->baseDir . PathConst::orderGoodsCreateTime, TIMESTAMP);
}
//任务脚本原来的方法是下面那个
// public function insertStoreMemberStatics()
// {
// $orderGoodDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName);
// $orderDao = \DAO\Order\OrderModel::getInstance();
// $storeMemberStatisticDao = \DAO\StoreMemberStatisticsModel::getInstance(DbNameConst::masterDBConnectName);
// $reufndReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::masterDBConnectName);
// $gmtCreate = file_get_contents($this->baseDir . PathConst::orderGoodsCreateTime);
// $gmtCreate = $gmtCreate ? $gmtCreate : ApiConst::zero;
// $beginTime = $gmtCreate;
// $this->taskIndex = PageConst::taskPageBegin;
// $this->taskSize = PageConst::taskPageSize;
// do {
// $storeMemberStatisticData = $orderGoodDao->getMemberStoreStaticsByCreateTime($beginTime, $this->taskIndex, $this->taskSize);
// $storeMemberStatisticData = isset($storeMemberStatisticData['list']) ? $storeMemberStatisticData['list'] : false;
// if ($storeMemberStatisticData) {
// $this->taskIndex++;
// $storeId = array_column($storeMemberStatisticData, 'storeId');
// $memberId = array_column($storeMemberStatisticData, 'buyerId');
// $storeIds = array_unique($storeId);
// $memberIds = array_unique($memberId);
// $goodsNumCount = $orderGoodDao->getMemberStoreOrderGoodsCount($storeIds, $memberIds);
// $ordersCount = $orderDao->getSumAmountCountByMemberAndStoreId($storeIds, $memberIds);
// $refundLists = $reufndReturnDao->getRefundSuccessMoneyByStoreIdAndMemberId($storeIds, $memberIds);
// if (!empty($ordersCount) && !empty($refundLists)) {
// foreach ($ordersCount as &$order) {
// foreach ($refundLists as $refund) {
// if ($order['buyerId'] == $refund['buyerId'] && $order['storeId'] == $refund['storeId']) {
// $order['orderTotal'] = $order['orderTotal'] - $refund['refundTotal'];
// }
// }
// }
// }
// if (!empty($goodsNumCount)) {
// $storeMemberStatisticDao->addAll($goodsNumCount, 'orderGoodsCount');
// }
// if (!empty($ordersCount)) {
// $storeMemberStatisticDao->addAll($ordersCount, 'orderTotal');
// }
// }
//
//
// } while ($storeMemberStatisticData);
// file_put_contents($this->baseDir . PathConst::orderGoodsCreateTime, TIMESTAMP);
//
// }
//任务脚本
// public function insertStoreMemberStatics()
// {
......
......@@ -419,7 +419,12 @@ class OrderModel extends \DAO\AbstractModel
return [];
}
}
public function getMemberStoreStaticsByCreateTime($gmtCreate,$pageIndex,$pageSize){
$this->setDb($this->dbName);
$where =\Our\Common::format(' gmt_update>={0} and gmt_update<{1} and order_state={2}',$gmtCreate,TIMESTAMP,ApiConst::orderStateWaitRecieve);
$res=$this->lists($where,array('gmt_update'=>'asc'),$this->sumField,$pageIndex,$pageSize);
return $res['list']?$res:false;
}
public function getSumAmountCountByMemberAndStoreId($storeIds,$memberIds)
{
$this->setDb($this->dbName);
......
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