Commit c4f4c5c1 authored by christ's avatar christ

temp

parent ab22b1d9
......@@ -666,9 +666,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$storeMemberStatisticData = isset($storeMemberStatisticData['list']) ? $storeMemberStatisticData['list'] : false;
if ($storeMemberStatisticData) {
$this->taskIndex++;
foreach($storeMemberStatisticData as $storeMemberStatics){
}
$storeIds = array_column($storeMemberStatisticData, 'storeId');
$memberIds = array_column($storeMemberStatisticData, 'buyerId');
$goodsNumCount = $orderGoodDao->getMemberStoreOrderGoodsCount($storeIds, $memberIds);
$refundLists = $reufndReturnDao->getRefundSuccessMoneyByStoreIdAndMemberId($storeIds, $memberIds);
}
......
......@@ -419,10 +419,11 @@ 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 not in({2},{3},{4})',$gmtCreate,TIMESTAMP,ApiConst::orderStateWaitPay,ApiConst::orderStateWaitConfirm,ApiConst::orderStateComplete);
$res=$this->lists($where,array('gmt_update'=>'asc'),$this->sumField,$pageIndex,$pageSize);
$res=$this->lists($where,array('gmt_update'=>'asc'),$this->getOrderDetailField(),$pageIndex,$pageSize);
return $res['list']?$res:false;
}
public function getSumAmountCountByMemberAndStoreId($storeIds,$memberIds)
......
......@@ -246,22 +246,31 @@ class OrderGoodsModel extends \DAO\AbstractModel {
}
public function getMemberStoreOrderGoodsCount($storeIds,$memberIds){
$this->setDb($this->dbName);
$orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$whereOrder['store_id']=array('in',$storeIds);
$whereOrder['buyer_id']=array('in',$memberIds);
$whereOrder['order_state']=array('in',ArrayConst::orderCloseAndCancel);
$orderIds=$orderDao->getFieldByWhere($whereOrder,'order_id');
$where['store_id']=array('in',$storeIds);
$where['buyer_id']=array('in',$memberIds);
$where['is_refund']=array('neq',ApiConst::refundSuccess);
if($orderIds){
$where['order_id']=array('notin',$orderIds);
}
$where=$this->db->getSqlWhereByArray($where);
$res=$this->db->from($this->_tableName)->select($this->sumGoodsNum)->where($where)->group("buyer_id")->group("store_id")->fetchAll();
return $res;
}
// public function getMemberStoreOrderGoodsCount($storeIds,$memberIds){
// $this->setDb($this->dbName);
// $orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
// $whereOrder['store_id']=array('in',$storeIds);
// $whereOrder['buyer_id']=array('in',$memberIds);
// $whereOrder['order_state']=array('in',ArrayConst::orderCloseAndCancel);
// $orderIds=$orderDao->getFieldByWhere($whereOrder,'order_id');
// $where['store_id']=array('in',$storeIds);
// $where['buyer_id']=array('in',$memberIds);
// $where['is_refund']=array('neq',ApiConst::refundSuccess);
// if($orderIds){
// $where['order_id']=array('notin',$orderIds);
// }
// $where=$this->db->getSqlWhereByArray($where);
// $res=$this->db->from($this->_tableName)->select($this->sumGoodsNum)->where($where)->group("buyer_id")->group("store_id")->fetchAll();
// return $res;
//
// }
public function getMemberStoreOrderGoodsCountBak($storeIds,$memberIds){
$this->setDb($this->dbName);
$orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
......
......@@ -68,6 +68,20 @@ class RefundReturnModel extends \DAO\AbstractModel
}
// public function getRefundSuccessMoneyByStoreIdAndMemberId($storeId, $buyerId)
// {
// $this->setDb($this->dbName);
// if (is_array($storeId)) {
// $storeId = implode(',', $storeId);
// }
// if (is_array($buyerId)) {
// $buyerId = implode(',', $buyerId);
// }
// $where = \Our\Common::format(" store_id in({0}) and buyer_id in({1}) and is_suc_refund={2}", $storeId, $buyerId, ApiConst::refundSuccess);
// $res = $this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(SUM(refund_amount)) AS refundTotal")->group('buyer_id')->group('store_id')->fetchAll();
// return !empty($res) ? $res : [];
//
// }
public function getRefundSuccessMoneyByStoreIdAndMemberId($storeId, $buyerId)
{
$this->setDb($this->dbName);
......@@ -78,7 +92,7 @@ class RefundReturnModel extends \DAO\AbstractModel
$buyerId = implode(',', $buyerId);
}
$where = \Our\Common::format(" store_id in({0}) and buyer_id in({1}) and is_suc_refund={2}", $storeId, $buyerId, ApiConst::refundSuccess);
$res = $this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(SUM(refund_amount)) AS refundTotal")->group('buyer_id')->group('store_id')->fetchAll();
$res = $this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(SUM(refund_amount)) AS refundTotal,")->group('buyer_id')->group('store_id')->fetchAll();
return !empty($res) ? $res : [];
}
......
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