Commit 78b790f9 authored by christ's avatar christ

order

parent 3b0ce628
...@@ -388,6 +388,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -388,6 +388,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
{ {
$order = array('gmt_update' => 'desc'); $order = array('gmt_update' => 'desc');
$orderDao=\DAO\Order\OrderModel::getInstance();
$storeId = $this->_getStoreByMemberId($memberId); $storeId = $this->_getStoreByMemberId($memberId);
if (empty($storeId)) { if (empty($storeId)) {
ErrorModel::throwException(CodeConfigModel::paramsError); ErrorModel::throwException(CodeConfigModel::paramsError);
...@@ -411,13 +412,16 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -411,13 +412,16 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$where = 'han_order.store_id=' . $storeId; $where = 'han_order.store_id=' . $storeId;
if ($orderState == ApiConst::oneHandred || (int)$orderState == ApiConst::oneHandredOne) { if ($orderState == ApiConst::oneHandred || (int)$orderState == ApiConst::oneHandredOne) {
if ($orderState == ApiConst::oneHandred) { if ($orderState == ApiConst::oneHandred) {
$where .= ' and han_order.shipping_type=' . ApiConst::bySelf; // $where=$orderDao->getWaitDeliveryCondition();
// $where .= ' and han_order.shipping_type=' . ApiConst::bySelf;
$where=$orderDao->getByselfCondition($storeId);
} else { } else {
$order=array( $order=array(
'diliveryman_id'=>'asc', 'diliveryman_id'=>'asc',
'gmt_update'=>'asc' 'gmt_update'=>'asc'
); );
$where .= ' and han_order.shipping_type=' . ApiConst::bySeller; // $where .= ' and han_order.shipping_type=' . ApiConst::bySeller;
$where=$orderDao->getWaitDeliveryCondition($storeId);
} }
} else { } else {
...@@ -916,7 +920,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -916,7 +920,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$storeId = $memberDao->getInfo($memberId, 'store_id'); $storeId = $memberDao->getInfo($memberId, 'store_id');
$orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName); $orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$waitReceiveCount = $orderDao->getCountByOrderState($storeId, ApiConst::orderStateWaitConfirm); $waitReceiveCount = $orderDao->getCountByOrderState($storeId, ApiConst::orderStateWaitConfirm);
$waitDeliveryCount = $orderDao->getCountByShippingTypeAndOrderState($storeId, ApiConst::bySeller, ApiConst::orderStateWaitRecieve); $waitDeliveryCount = $orderDao->getCountByShippingTypeAndOrderState($storeId, ApiConst::bySeller, array(ApiConst::orderStateWaitSend,ApiConst::orderStateWaitRecieve));
$waitGetCount = $orderDao->getCountByShippingTypeAndOrderState($storeId, ApiConst::bySelf, ApiConst::orderStateWaitRecieve); $waitGetCount = $orderDao->getCountByShippingTypeAndOrderState($storeId, ApiConst::bySelf, ApiConst::orderStateWaitRecieve);
$orderCount=$waitReceiveCount+$waitDeliveryCount+$waitGetCount; $orderCount=$waitReceiveCount+$waitDeliveryCount+$waitGetCount;
return array('waitReceiveCount' => $waitReceiveCount, 'waitDeliveryCount' => $waitDeliveryCount, 'waitGetCount' => $waitGetCount,'orderCount'=>$orderCount); return array('waitReceiveCount' => $waitReceiveCount, 'waitDeliveryCount' => $waitDeliveryCount, 'waitGetCount' => $waitGetCount,'orderCount'=>$orderCount);
......
...@@ -1128,10 +1128,33 @@ class OrderModel extends \DAO\AbstractModel ...@@ -1128,10 +1128,33 @@ class OrderModel extends \DAO\AbstractModel
$count=$this->getCountByWhere($where); $count=$this->getCountByWhere($where);
return $count; return $count;
} }
public function getCountByShippingTypeAndOrderState($storeId,$shippingType,$orderState){ //获得店铺待配送或者待自提订单条件
$where['store_id']=$storeId; public function getWaitDeliveryCondition($id,$memberType='seller'){
$where['shipping_type']=$shippingType; if($memberType=='seller'){
$where['order_state']=$orderState; $where['store_id']=$id;
}else{
$where['member_id']=$id;
}
$where['shipping_type']=ApiConst::bySeller;
$where['order_state']=array('in',array(ApiConst::orderStateWaitSend,ApiConst::orderStateWaitRecieve));
}
public function getByselfCondition($id,$memberType='seller'){
if($memberType=='seller'){
$where['store_id']=$id;
}else{
$where['member_id']=$id;
}
$where['shipping_type']=ApiConst::bySelf;
$where['order_state']=ApiConst::orderStateWaitRecieve;
}
public function getCountByShippingTypeAndOrderState($storeId,$type='bySeller'){
if($type=='bySeller'){
$where=$this->getWaitDeliveryCondition($storeId);
}
if($type=='bySelf'){
$where=$this->getByselfCondition($storeId);
}
$count=$this->getCountByWhere($where); $count=$this->getCountByWhere($where);
return $count; return $count;
} }
......
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