Commit 9b36a35b authored by liuyuzhen's avatar liuyuzhen

Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into lyz_version1

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