Commit dd8b9e03 authored by zhz's avatar zhz

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

parents ea959189 4c1729a5
...@@ -915,11 +915,7 @@ class OrderConfirmUtil { ...@@ -915,11 +915,7 @@ class OrderConfirmUtil {
public function makeOrderSn($pay_id) { public function makeOrderSn($pay_id) {
//记录生成子订单的个数,如果生成多个子订单,该值会累加 //记录生成子订单的个数,如果生成多个子订单,该值会累加
static $num; static $num;
if (empty($num)) { $num = rand(0,99);
$num = 1;
} else {
$num ++;
}
return (date('y',time()) % 9+1) . sprintf('%013d', $pay_id) . sprintf('%02d', $num); return (date('y',time()) % 9+1) . sprintf('%013d', $pay_id) . sprintf('%02d', $num);
} }
......
...@@ -155,6 +155,7 @@ class ApiConst ...@@ -155,6 +155,7 @@ class ApiConst
const orderStateClose = -1;//关闭定单 const orderStateClose = -1;//关闭定单
const receivePayment = 1;//商家收到货款了 const receivePayment = 1;//商家收到货款了
const noreceivePayment = 0;//商家未收到货款 const noreceivePayment = 0;//商家未收到货款
const returnWaitReceive=2;//退货待收货
const deleteStateOne = 1; const deleteStateOne = 1;
const deleteStateZero = 0; const deleteStateZero = 0;
const deleteStateTwo = 2; const deleteStateTwo = 2;
......
...@@ -181,6 +181,10 @@ class NameConst { ...@@ -181,6 +181,10 @@ class NameConst {
const versionOne = '1.0.0'; const versionOne = '1.0.0';
const versionDefault = '1.0'; const versionDefault = '1.0';
const bySeller='bySeller';
const bySelf='bySelf';
} }
?> ?>
\ No newline at end of file
...@@ -231,7 +231,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -231,7 +231,7 @@ class OrderServiceModel extends \Business\AbstractModel
*/ */
public function getOrderDetail($orderId) public function getOrderDetail($orderId)
{ {
// error_reporting(E_ALL); error_reporting(E_ALL);
$orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName); $orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$addressDao = \DAO\AddressModel::getInstance(DbNameConst::salveDBConnectName); $addressDao = \DAO\AddressModel::getInstance(DbNameConst::salveDBConnectName);
$orderCommonDao = \DAO\Order\OrderCommonModel::getInstance(DbNameConst::salveDBConnectName); $orderCommonDao = \DAO\Order\OrderCommonModel::getInstance(DbNameConst::salveDBConnectName);
...@@ -268,7 +268,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -268,7 +268,7 @@ class OrderServiceModel extends \Business\AbstractModel
//商店相关信息 //商店相关信息
// $this->store=$storeDao->get($this->order['storeId']); // $this->store=$storeDao->get($this->order['storeId']);
// $this->store=Common::convertUnderline($this->store[0]); // $this->store=Common::convertUnderline($this->store[0]);
$this->store = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$storeDao, 'getInfoById'), array($this->order['storeId'], $storeDao->detailField), \Our\ApiConst::sevenDaySecond,array($this->order['storeId'])); $this->store = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$storeDao, 'getInfoById'), array($this->order['storeId'], $storeDao->detailField), \Our\ApiConst::sevenDaySecond,array($this->order['storeId']));
$returnData = $this->order; $returnData = $this->order;
//配送员信息 //配送员信息
$this->diliveryman = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$diliverymanDao, 'findById'), array($returnData['diliverymanId']), \Our\ApiConst::oneDaySecond); $this->diliveryman = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$diliverymanDao, 'findById'), array($returnData['diliverymanId']), \Our\ApiConst::oneDaySecond);
...@@ -300,9 +300,10 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -300,9 +300,10 @@ class OrderServiceModel extends \Business\AbstractModel
if(CURRENTVERSION!=NameConst::versionOne){ if(CURRENTVERSION!=NameConst::versionOne){
$returnData['offlinePayway']=''; $returnData['offlinePayway']='';
} }
$returnData['storeMemberId']=$this->store['memberId']; $returnData['storeMemberId']=$this->store['memberId'];
$returnData['totalGoodsNum'] = $orderGoodsDao->getGoodsCount($this->orderGoodsList); $returnData['totalGoodsNum'] = $orderGoodsDao->getGoodsCount($this->orderGoodsList);
// $returnData['offlinePayway'] = $this->store['offlinePayway'] ? $this->store['offlinePayway'] : ''; // $returnData['offlinePayway'] =$this->store['offlinePayway'] ? $this->store['offlinePayway'] : '';
$this->address['address']=$orderCommonDao->convertReceiveAddress($this->address['address']); $this->address['address']=$orderCommonDao->convertReceiveAddress($this->address['address']);
$returnData['reciverInfo'] = $this->address; $returnData['reciverInfo'] = $this->address;
$returnData['reciverInfo']['mobPhone']=!empty($returnData['reciverInfo']['mobPhone'])?$returnData['reciverInfo']['mobPhone']:''; $returnData['reciverInfo']['mobPhone']=!empty($returnData['reciverInfo']['mobPhone'])?$returnData['reciverInfo']['mobPhone']:'';
...@@ -1035,7 +1036,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -1035,7 +1036,7 @@ class OrderServiceModel extends \Business\AbstractModel
break; break;
} else if (($order['payment_type'] == \Our\ApiConst::payOffline||$order['payment_type'] == \Our\ApiConst::payAog) && $order['order_state'] == \Our\ApiConst::orderStateWaitConfirm) {//已下单的待线上支付订单 } else if (($order['payment_type'] == \Our\ApiConst::payOffline||$order['payment_type'] == \Our\ApiConst::payAog) && $order['order_state'] == \Our\ApiConst::orderStateWaitConfirm) {//已下单的待线上支付订单
$orderTips = \Our\DescribeConst::addOrderSuccessTips; $orderTips = \Our\DescribeConst::addOrderSuccessTips;
$store = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$storeDao, 'getInfoById'), array($order['store_id']), \Our\ApiConst::oneHour); $store = $storeDao->get($order['store_id'],false);
$orderContent['storeName'] = $store['store_name']; $orderContent['storeName'] = $store['store_name'];
if ($order['payment_type'] == \Our\ApiConst::payOffline) { if ($order['payment_type'] == \Our\ApiConst::payOffline) {
$orderContent['imageUrls'] = array(); $orderContent['imageUrls'] = array();
......
...@@ -409,36 +409,28 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -409,36 +409,28 @@ class RefundServiceModel extends \Business\AbstractModel
$addressDao = \DAO\Order\DAddressModel::getInstance(DbNameConst::salveDBConnectName); $addressDao = \DAO\Order\DAddressModel::getInstance(DbNameConst::salveDBConnectName);
$orderCommonDao = \DAO\Order\OrderCommonModel::getInstance(); $orderCommonDao = \DAO\Order\OrderCommonModel::getInstance();
$where['store_id'] = $storeId; // $where['store_id'] = $storeId;
$where['order_lock'] = 2; // $where['order_lock'] = 2;
$order = array('add_time' => 'desc'); $order = array('add_time' => 'desc');
switch($type) { if($type==ApiConst::refundSellerVerify){
case 1: $where=$refundReturnDao->getProccessOrderBySeller($storeId);
$where['refund_state'] = 1; }
break; if($type==ApiConst::refundSellerAgree){
case 2: $where=$refundReturnDao->getReturnWaitReceive($storeId);
$where['refund_state'] = 2;
$where['refund_type'] = 2;
$order= array('receive_time'=> 'asc'); $order= array('receive_time'=> 'asc');
break;
} }
//获得售后列表 //获得售后列表
$refundReturns = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$refundReturnDao, 'getList'), array($where, $this->storeRefundReturnField, $pageIndex, $pageSize, $order), \Our\ApiConst::oneDaySecond, array($storeId)); $refundReturns = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$refundReturnDao, 'getList'), array($where, $this->storeRefundReturnField, $pageIndex, $pageSize,$order), \Our\ApiConst::oneDaySecond, array($storeId));
$orderGoodsId = array_column($refundReturns['list'], 'orderGoodsId'); $orderGoodsId = array_column($refundReturns['list'], 'orderGoodsId');
//获得售后商品列表getOrderGoodsByRecIds //获得售后商品列表getOrderGoodsByRecIds
if (!empty($orderGoodsId)) { if (!empty($orderGoodsId)) {
$orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByRecIds'), array($orderGoodsId, $this->refundOrderGoodsField), \Our\ApiConst::oneDaySecond, array($storeId)); $orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByRecIds'), array($orderGoodsId, $this->refundOrderGoodsField), \Our\ApiConst::oneDaySecond, array($storeId));
$refundMerge = Common::intergrateOneToOne($refundReturns['list'], $orderGoods, 'orderGoodsId', 'recId'); $refundMerge = Common::intergrateOneToOne($refundReturns['list'], $orderGoods, 'orderGoodsId', 'recId');
$orderIds= array_column($refundMerge, 'orderId'); $orderIds= array_column($refundMerge, 'orderId');
$orderWhere['order_id']=array('in',$orderIds); $orderWhere['order_id']=array('in',$orderIds);
$orders = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderDao, 'getList'), array($orderWhere, "order_id as orderId,goods_amount as goodsAmount,order_amount as orderAmount,shipping_fee as shippingFee,order_sn as orderSn,payment_type as paymentType", ApiConst::zero, $pageSize, $order, \Our\ApiConst::oneDaySecond, array($storeId))); $orders = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderDao, 'getList'), array($orderWhere, $orderDao->getOrderDetailField(), ApiConst::zero, $pageSize), \Our\ApiConst::oneDaySecond, array($storeId));
$orders=$orderDao->convertOrder($orders['list'],'orderId'); $orders=$orderDao->convertOrder($orders['list'],'orderId');
$orderCommons = $orderCommonDao->getAllByOrderIds($orderIds, $orderCommonDao->orderCommonField); $orderCommons = $orderCommonDao->getAllByOrderIds($orderIds, $orderCommonDao->orderCommonField);
$orderCommons=$orderDao->convertOrder($orderCommons,'orderId'); $orderCommons=$orderDao->convertOrder($orderCommons,'orderId');
......
...@@ -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,8 +920,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -916,8 +920,8 @@ 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);
$waitGetCount = $orderDao->getCountByShippingTypeAndOrderState($storeId, ApiConst::bySelf, ApiConst::orderStateWaitRecieve); $waitGetCount = $orderDao->getCountByShippingTypeAndOrderState($storeId,NameConst::bySelf);
$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);
} }
...@@ -927,8 +931,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -927,8 +931,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$storeId = $memberDao->getInfo($memberId, 'store_id'); $storeId = $memberDao->getInfo($memberId, 'store_id');
$refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName); $refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName);
//待处理 //待处理
$waitRefundProccessCount = $refundReturnDao->getCountByRefundState($storeId, ApiConst::orderStateWaitConfirm); $waitRefundProccessCount = $refundReturnDao->getCountByRefundState($storeId);
$waitRefundReceiveCount = $refundReturnDao->getCountByRefundType($storeId, ApiConst::refundTypeGoods); $waitRefundReceiveCount = $refundReturnDao->getCountByRefundType($storeId);
$refundCount=$waitRefundProccessCount+$waitRefundReceiveCount; $refundCount=$waitRefundProccessCount+$waitRefundReceiveCount;
return array('waitRefundProccessCount' => $waitRefundProccessCount, 'waitRefundReceiveCount' => $waitRefundReceiveCount, 'refundCount' =>$refundCount); return array('waitRefundProccessCount' => $waitRefundProccessCount, 'waitRefundReceiveCount' => $waitRefundReceiveCount, 'refundCount' =>$refundCount);
} }
......
...@@ -1128,10 +1128,35 @@ class OrderModel extends \DAO\AbstractModel ...@@ -1128,10 +1128,35 @@ 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));
return $where;
}
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;
return $where;
}
public function getCountByShippingTypeAndOrderState($storeId,$type=NameConst::bySeller){
if($type==NameConst::bySeller){
$where=$this->getWaitDeliveryCondition($storeId);
}
if($type==NameConst::bySelf){
$where=$this->getByselfCondition($storeId);
}
$count=$this->getCountByWhere($where); $count=$this->getCountByWhere($where);
return $count; return $count;
} }
......
...@@ -558,21 +558,32 @@ class RefundReturnModel extends \DAO\AbstractModel { ...@@ -558,21 +558,32 @@ class RefundReturnModel extends \DAO\AbstractModel {
* @param $orderState * @param $orderState
* @return mixed 待处理 * @return mixed 待处理
*/ */
public function getCountByRefundState($storeId,$refundState){ public function getCountByRefundState($storeId){
$where['store_id']=$storeId; $where=$this->getProccessOrderBySeller($storeId);
$where['refund_state']=$refundState;
$count=$this->getCountByWhere($where); $count=$this->getCountByWhere($where);
return $count; return $count;
} }
//获得售后待处理订单条件
public function getProccessOrderBySeller($id){
$where['store_id']=$id;
$where['refund_state']=ApiConst::refundSellerVerify;
return $where;
}
//获得售后待收货订单条件
public function getReturnWaitReceive($id){
$where['store_id']=$id;
$where['refund_type']=ApiConst::refundTypeGoods;
$where['goods_state']=ApiConst::goodsStateWaitRecieve;
return $where;
}
/** /**
* @param $storeId * @param $storeId
* @param $orderState * @param $orderState
* @return mixed 待收货 * @return mixed 待收货
*/ */
public function getCountByRefundType($storeId,$refundType){ public function getCountByRefundType($storeId){
$where['store_id']=$storeId; $where=$this->getReturnWaitReceive($storeId);
$where['refund_type']=$refundType;
$where['goods_state']=array('neq',ApiConst::four);
$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