Commit 4c733b0e authored by wwccw0591's avatar wwccw0591

pc

parent 73a2ac70
......@@ -312,7 +312,7 @@ class OrderServiceModel extends \Business\AbstractModel
if($resultRefund){
$where['order_id']=$order['orderId'];
//$orderGoodsUpdateData['refund_state_name']='退款成功';
$orderGoodsUpdateData['is_refund']=1;
$orderGoodsUpdateData['is_refund']=ApiConst::refundSuccess;
$orderGoodsDao->update($where,$orderGoodsUpdateData);
}
}
......
......@@ -83,13 +83,18 @@ class OrderModel extends \DAO\AbstractModel
public function getShopKeeperCountByStoreId($storeId)
{
$refundReturnDao=\DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName);
$begin = strtotime(date("Y-m-d"), time());
$end = TIMESTAMP;
$notInState=ApiConst::orderStateCancel.','.ApiConst::orderStateClose;
$where = Common::format(" store_id={0} and order_state not in ({1})", $storeId,$notInState);
$orderTotal = $this->getOrderCounts($where, $this->countField);
$where .= Common::format(" and add_time between {0} and {1}", $begin, $end);
$refundAmount=$refundReturnDao->getRefundSuccessMoneyByStoreId($storeId);
$orderTotal=$orderTotal-$refundAmount;
$where .= Common::format(" and gmt_update between {0} and {1}", $begin, $end);
$todayTotal = $this->getOrderCounts($where, $this->countField);
$todayRefund=$refundReturnDao->getRefundSuccessMoneyByStoreId($storeId,$begin,$end);
$todayTotal=$todayTotal-$todayRefund;
$total['todayOrderTotal'] = isset($todayTotal['orderTotal']) ? $todayTotal['orderTotal'] : ApiConst::zero;
$total['todayOrderCount'] = isset($todayTotal['orderCount']) ? $todayTotal['orderCount'] : ApiConst::zero;
$total['orderTotal'] = isset($orderTotal['orderTotal']) ? (int)$orderTotal['orderTotal'] : ApiConst::zero;
......
......@@ -65,6 +65,7 @@ class OrderGoodsModel extends \DAO\AbstractModel {
public function getOrderGoodsCountByStoreId($storeId){
$this->setDb($this->dbName);
$where['store_id']=$storeId;
$where['is_refund']=array('neq',ApiConst::refundSuccess);
$goodsCount = $this->db->select($this->orderGoodsGoodsNumCountField)->from($this->_tableName)->where($where)->fetchNum();
return $goodsCount;
}
......@@ -230,15 +231,9 @@ class OrderGoodsModel extends \DAO\AbstractModel {
}
public function getMemberStoreOrderGoodsCount($storeIds,$memberIds){
$this->setDb($this->dbName);
// if(is_array($storeIds)){
// $storeIds=implode(',',$storeIds);
// }
// if(is_array($memberIds)){
// $memberIds=implode($memberIds);
// }
$where['store_id']=array('in',$storeIds);
$where['buyer_id']=array('in',$memberIds);
$where['is_refund']=array('neq',ApiConst::one);
$where['is_refund']=array('neq',ApiConst::refundSuccess);
$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;
......
......@@ -26,6 +26,7 @@ class RefundReturnModel extends \DAO\AbstractModel {
public $refundDetailField='is_platform_in as isPlatformIn,seller_state as sellerState,platform_state as platformState,refund_id as refundId,order_id as orderId,store_id as storeId,order_goods_id as orderGoodsId';
public $refundReturnField="seller_state,refund_state,is_platform_in,platform_state";
private $sumField="order_id as orderId,buyer_id as buyerId,store_id as storeId,goods_num as goodsNum,refund_amount as refundAmount,is_suc_refund as isSucRefund,gmt_update as gmtUpdate";
private $sumRefundAmount=" sum(refund_amount) as sumRefundAmont";
/**
* 主键
*
......@@ -47,6 +48,18 @@ class RefundReturnModel extends \DAO\AbstractModel {
return $list;
}
public function getRefundSuccessMoneyByStoreId($storeId,$beginTime=false,$endTime=false){
$this->setDb($this->dbName);
if($beginTime){
$where=\Our\Common::format(" store_id={0} and refund_state={1} and between {2} and {3}",$storeId,ApiConst::refundSuccess,$beginTime,$endTime);
}else{
$where=\Our\Common::format(" store_id={0} and refund_state={1}",$storeId);
}
$res=$this->db->from($this->_tableName)->select($this->sumRefundAmount)->where($where)->fetchValue();
return $res?$res:ApiConst::zero;
}
/**
* 更新数据
* @param $data
......
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