Commit 9c1322a7 authored by chenchuanwen's avatar chenchuanwen

退货退款

parent 363668ee
...@@ -77,8 +77,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -77,8 +77,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$data['storeName'] = $store['store_name']; $data['storeName'] = $store['store_name'];
$data['storeLabel'] = $store['store_label']; $data['storeLabel'] = $store['store_label'];
$data['goodsCount'] = $goodsCount?$goodsCount:ApiConst::zero; $data['goodsCount'] = $goodsCount?$goodsCount:ApiConst::zero;
$data['goodsCount']=(int)$data['goodsCount'];
$data['orderCount'] = $storeStats['orderCount']; $data['orderCount'] = $storeStats['orderCount'];
$data['orderTotal'] = $orderTotal?$orderTotal:ApiConst::zero; $data['orderTotal'] = $orderTotal?$orderTotal:ApiConst::zero;
$data['orderTotal']= (int)$data['orderTotal'];
$data['orderTotalOnline'] = $orderTotalOnline; $data['orderTotalOnline'] = $orderTotalOnline;
$data['favCount'] = $storeFavariteCount['favCount']; $data['favCount'] = $storeFavariteCount['favCount'];
$data['todayOrderCount'] = $storeStats['todayOrderCount']; $data['todayOrderCount'] = $storeStats['todayOrderCount'];
......
...@@ -478,20 +478,30 @@ class OrderModel extends \DAO\AbstractModel ...@@ -478,20 +478,30 @@ class OrderModel extends \DAO\AbstractModel
} }
public function getOrderOrderTotalOnlineByStoreId($storeId,$today=false){ public function getOrderOrderTotalOnlineByStoreId($storeId,$today=false){
$this->setDb($this->dbName); $this->setDb($this->dbName);
$refundReturnDao=\DAO\Order\RefundReturnModel::getInstance();
$where['store_id']=$storeId; $where['store_id']=$storeId;
$where['order_state']=array('notin',ArrayConst::orderCloseAndCancel); $where['order_state']=array('notin',ArrayConst::orderCloseAndCancel);
$where['refund_state']=array('neq',ApiConst::refundStateAll); // $where['refund_state']=array('neq',ApiConst::refundStateAll);
$where['payment_type']=array('in',ArrayConst::payTypeOnlines); $where['payment_type']=array('in',ArrayConst::orderPayTypeOnlines);
if($today){ if($today){
$todayBegin=Common::getTodayBeginTimpSpan(); $todayBegin=Common::getTodayBeginTimpSpan();
$where['gmt_update']=array('egt',$todayBegin); $where['gmt_update']=array('between',$todayBegin,TIMESTAMP);
$where['gmt_update']=array('elt',TIMESTAMP); // $where['gmt_update']=array('elt',TIMESTAMP);
} }
if(is_array($where)){ if(is_array($where)){
$where= $this->db->getSqlWhereByArray($where); $where= $this->db->getSqlWhereByArray($where);
} }
if($today){
$res=$this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(order_amount-refund_amount) as orderTotalOnline")->fetchOne(); $refundAmount= $refundReturnDao->getSumRefundAmountByStoreId($storeId,$today);
}else{
$refundAmount= $refundReturnDao->getSumRefundAmountByStoreId($storeId);
}
$res=$this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,order_amount as orderTotalOnline")->fetchOne();
if(!$res){
$res=array();
$res['orderTotalOnline']=ApiConst::zero;
$res['orderTotalOnline']-=$refundAmount;
}
return $res?$res:array(); return $res?$res:array();
} }
......
...@@ -728,6 +728,18 @@ class RefundReturnModel extends \DAO\AbstractModel ...@@ -728,6 +728,18 @@ class RefundReturnModel extends \DAO\AbstractModel
$res=$this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(SUM(refund_amount)) AS refundAmount")->fetchOne(); $res=$this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(SUM(refund_amount)) AS refundAmount")->fetchOne();
return $res?$res:array(); return $res?$res:array();
} }
public function getSumRefundAmountByStoreId($storeId,$today=false){
$this->setDb($this->dbName);
if($today){
$todayBegin=\Our\Common::getTodayBeginTimpSpan();
$res=$this->getRefundSuccessMoneyByStoreId($storeId,$todayBegin,TIMESTAMP);
}else{
$res=$this->getRefundSuccessMoneyByStoreId($storeId);
}
return $res?$res:ApiConst::zero;
}
/** /**
* @param $storeId * @param $storeId
* @param $orderState * @param $orderState
......
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