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 {
public function makeOrderSn($pay_id) {
//记录生成子订单的个数,如果生成多个子订单,该值会累加
static $num;
if (empty($num)) {
$num = 1;
} else {
$num ++;
}
$num = rand(0,99);
return (date('y',time()) % 9+1) . sprintf('%013d', $pay_id) . sprintf('%02d', $num);
}
......
......@@ -155,6 +155,7 @@ class ApiConst
const orderStateClose = -1;//关闭定单
const receivePayment = 1;//商家收到货款了
const noreceivePayment = 0;//商家未收到货款
const returnWaitReceive=2;//退货待收货
const deleteStateOne = 1;
const deleteStateZero = 0;
const deleteStateTwo = 2;
......
......@@ -181,6 +181,10 @@ class NameConst {
const versionOne = '1.0.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
*/
public function getOrderDetail($orderId)
{
// error_reporting(E_ALL);
error_reporting(E_ALL);
$orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$addressDao = \DAO\AddressModel::getInstance(DbNameConst::salveDBConnectName);
$orderCommonDao = \DAO\Order\OrderCommonModel::getInstance(DbNameConst::salveDBConnectName);
......@@ -268,7 +268,7 @@ class OrderServiceModel extends \Business\AbstractModel
//商店相关信息
// $this->store=$storeDao->get($this->order['storeId']);
// $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;
//配送员信息
$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
if(CURRENTVERSION!=NameConst::versionOne){
$returnData['offlinePayway']='';
}
$returnData['storeMemberId']=$this->store['memberId'];
$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']);
$returnData['reciverInfo'] = $this->address;
$returnData['reciverInfo']['mobPhone']=!empty($returnData['reciverInfo']['mobPhone'])?$returnData['reciverInfo']['mobPhone']:'';
......@@ -1035,7 +1036,7 @@ class OrderServiceModel extends \Business\AbstractModel
break;
} else if (($order['payment_type'] == \Our\ApiConst::payOffline||$order['payment_type'] == \Our\ApiConst::payAog) && $order['order_state'] == \Our\ApiConst::orderStateWaitConfirm) {//已下单的待线上支付订单
$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'];
if ($order['payment_type'] == \Our\ApiConst::payOffline) {
$orderContent['imageUrls'] = array();
......
......@@ -409,36 +409,28 @@ class RefundServiceModel extends \Business\AbstractModel
$addressDao = \DAO\Order\DAddressModel::getInstance(DbNameConst::salveDBConnectName);
$orderCommonDao = \DAO\Order\OrderCommonModel::getInstance();
$where['store_id'] = $storeId;
$where['order_lock'] = 2;
// $where['store_id'] = $storeId;
// $where['order_lock'] = 2;
$order = array('add_time' => 'desc');
switch($type) {
case 1:
$where['refund_state'] = 1;
break;
case 2:
$where['refund_state'] = 2;
$where['refund_type'] = 2;
if($type==ApiConst::refundSellerVerify){
$where=$refundReturnDao->getProccessOrderBySeller($storeId);
}
if($type==ApiConst::refundSellerAgree){
$where=$refundReturnDao->getReturnWaitReceive($storeId);
$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');
//获得售后商品列表getOrderGoodsByRecIds
if (!empty($orderGoodsId)) {
$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');
$orderIds= array_column($refundMerge, 'orderId');
$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');
$orderCommons = $orderCommonDao->getAllByOrderIds($orderIds, $orderCommonDao->orderCommonField);
$orderCommons=$orderDao->convertOrder($orderCommons,'orderId');
......
......@@ -388,6 +388,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
{
$order = array('gmt_update' => 'desc');
$orderDao=\DAO\Order\OrderModel::getInstance();
$storeId = $this->_getStoreByMemberId($memberId);
if (empty($storeId)) {
ErrorModel::throwException(CodeConfigModel::paramsError);
......@@ -411,13 +412,16 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$where = 'han_order.store_id=' . $storeId;
if ($orderState == ApiConst::oneHandred || (int)$orderState == ApiConst::oneHandredOne) {
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 {
$order=array(
'diliveryman_id'=>'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 {
......@@ -916,8 +920,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$storeId = $memberDao->getInfo($memberId, 'store_id');
$orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$waitReceiveCount = $orderDao->getCountByOrderState($storeId, ApiConst::orderStateWaitConfirm);
$waitDeliveryCount = $orderDao->getCountByShippingTypeAndOrderState($storeId, ApiConst::bySeller, ApiConst::orderStateWaitRecieve);
$waitGetCount = $orderDao->getCountByShippingTypeAndOrderState($storeId, ApiConst::bySelf, ApiConst::orderStateWaitRecieve);
$waitDeliveryCount = $orderDao->getCountByShippingTypeAndOrderState($storeId);
$waitGetCount = $orderDao->getCountByShippingTypeAndOrderState($storeId,NameConst::bySelf);
$orderCount=$waitReceiveCount+$waitDeliveryCount+$waitGetCount;
return array('waitReceiveCount' => $waitReceiveCount, 'waitDeliveryCount' => $waitDeliveryCount, 'waitGetCount' => $waitGetCount,'orderCount'=>$orderCount);
}
......@@ -927,8 +931,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$storeId = $memberDao->getInfo($memberId, 'store_id');
$refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName);
//待处理
$waitRefundProccessCount = $refundReturnDao->getCountByRefundState($storeId, ApiConst::orderStateWaitConfirm);
$waitRefundReceiveCount = $refundReturnDao->getCountByRefundType($storeId, ApiConst::refundTypeGoods);
$waitRefundProccessCount = $refundReturnDao->getCountByRefundState($storeId);
$waitRefundReceiveCount = $refundReturnDao->getCountByRefundType($storeId);
$refundCount=$waitRefundProccessCount+$waitRefundReceiveCount;
return array('waitRefundProccessCount' => $waitRefundProccessCount, 'waitRefundReceiveCount' => $waitRefundReceiveCount, 'refundCount' =>$refundCount);
}
......
......@@ -1128,10 +1128,35 @@ class OrderModel extends \DAO\AbstractModel
$count=$this->getCountByWhere($where);
return $count;
}
public function getCountByShippingTypeAndOrderState($storeId,$shippingType,$orderState){
$where['store_id']=$storeId;
$where['shipping_type']=$shippingType;
$where['order_state']=$orderState;
//获得店铺待配送或者待自提订单条件
public function getWaitDeliveryCondition($id,$memberType='seller'){
if($memberType=='seller'){
$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);
return $count;
}
......
......@@ -558,21 +558,32 @@ class RefundReturnModel extends \DAO\AbstractModel {
* @param $orderState
* @return mixed 待处理
*/
public function getCountByRefundState($storeId,$refundState){
$where['store_id']=$storeId;
$where['refund_state']=$refundState;
public function getCountByRefundState($storeId){
$where=$this->getProccessOrderBySeller($storeId);
$count=$this->getCountByWhere($where);
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 $orderState
* @return mixed 待收货
*/
public function getCountByRefundType($storeId,$refundType){
$where['store_id']=$storeId;
$where['refund_type']=$refundType;
$where['goods_state']=array('neq',ApiConst::four);
public function getCountByRefundType($storeId){
$where=$this->getReturnWaitReceive($storeId);
$count=$this->getCountByWhere($where);
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