Commit 6b33597d authored by liuyuzhen's avatar liuyuzhen

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

parents 02fa8dbd bab09805
...@@ -36,8 +36,10 @@ class IndexController extends \Our\Controller_Abstract { ...@@ -36,8 +36,10 @@ class IndexController extends \Our\Controller_Abstract {
// ErrorModel::throwException(CodeConfigModel::authExpire); // ErrorModel::throwException(CodeConfigModel::authExpire);
} }
$this->memberDb0Redis=\Redis\Db0\MemberRedisModel::getInstance(); $this->memberDb0Redis=\Redis\Db0\MemberRedisModel::getInstance();
$paramsStr= $this->memberDb0Redis->tablelpop($this->key); $paramsStr= $this->memberDb0Redis->tablelpop($this->key);
$paramsStr=json_decode($paramsStr,true); $paramsStr=json_decode($paramsStr,true);
$this->_view->assign("params", $paramsStr); $this->_view->assign("params", $paramsStr);
if($paramsStr['type']==\Our\ApiConst::sharePlat){ if($paramsStr['type']==\Our\ApiConst::sharePlat){
$this->_view->display('index/plat.phtml'); $this->_view->display('index/plat.phtml');
...@@ -45,7 +47,7 @@ class IndexController extends \Our\Controller_Abstract { ...@@ -45,7 +47,7 @@ class IndexController extends \Our\Controller_Abstract {
if($paramsStr['type']==\Our\ApiConst::shareStore){ if($paramsStr['type']==\Our\ApiConst::shareStore){
$this->_view->display('index/store.phtml'); $this->_view->display('index/store.phtml');
} }
if($paramsStr['type']==\Our\ApiConst::shareGoods || \Our\ApiConst::shareGroup){ if($paramsStr['type']==\Our\ApiConst::shareGoods || $paramsStr['type']==\Our\ApiConst::shareGroup){
$this->_view->display('index/goods.phtml'); $this->_view->display('index/goods.phtml');
} }
if($paramsStr['type']==\Our\ApiConst::shareSaler){ if($paramsStr['type']==\Our\ApiConst::shareSaler){
......
...@@ -421,6 +421,7 @@ class ApiConst ...@@ -421,6 +421,7 @@ class ApiConst
const deliveryOrderType = 16; const deliveryOrderType = 16;
//pcClient 消息推送消息模板类型常量 //pcClient 消息推送消息模板类型常量
const messageWaitReceive=101; const messageWaitReceive=101;
//售后
const messageRefund=102; const messageRefund=102;
//待配送 //待配送
const messageWaitSend=102; const messageWaitSend=102;
......
...@@ -875,6 +875,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -875,6 +875,7 @@ class OrderServiceModel extends \Business\AbstractModel
$orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName); $orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName); $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName);
$orderCommonDao = \DAO\Order\OrderCommonModel::getInstance(DbNameConst::salveDBConnectName); $orderCommonDao = \DAO\Order\OrderCommonModel::getInstance(DbNameConst::salveDBConnectName);
$refundReturnDao=\DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName);
$memberDao = \DAO\MemberModel::getInstance(DbNameConst::salveDBConnectName); $memberDao = \DAO\MemberModel::getInstance(DbNameConst::salveDBConnectName);
$qmMans=$qmDeliveryMan->getListByMemberId($memberId); $qmMans=$qmDeliveryMan->getListByMemberId($memberId);
$diliverymanIds=array_column($qmMans,'id'); $diliverymanIds=array_column($qmMans,'id');
...@@ -882,8 +883,26 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -882,8 +883,26 @@ class OrderServiceModel extends \Business\AbstractModel
if (empty($diliverymanIds)) { if (empty($diliverymanIds)) {
ErrorModel::throwException(CodeConfigModel::commonError); ErrorModel::throwException(CodeConfigModel::commonError);
} }
$qmDeliveryLogList = $qmDeliveryLogDao->getListByDeliverymanIdAndTypeCache($diliverymanIds, $type, $pageIndex, $pageSize,array('get_time' => 'desc'),$memberId); $qmDeliveryLogList = $qmDeliveryLogDao->getListByDeliverymanIdAndTypeCache($diliverymanIds, $type, ApiConst::pageIndex, $pageSize,array('get_time' => 'desc'),$memberId);
$orderIds = array_column($qmDeliveryLogList['list'], 'orderId'); $orderIds=Array();
foreach($qmDeliveryLogList['list'] as $qmDeliveryLog){
if($qmDeliveryLog['orderType']==ApiConst::orderTypeRefund){
$refundids[]=$qmDeliveryLog['orderId'];
}else{
$orderIds[]=$qmDeliveryLog['orderId'];
}
}
if(!empty($refundids)){
$refundWhere['refund_id']=array('in',$refundids);
$refundOrders=$refundReturnDao->getList($refundWhere,$refundReturnDao->refundDetailField,ApiConst::zero,ApiConst::pageSize);
$refundOrders=$refundReturnDao->convertCommonList($refundOrders['list'],'orderGoodsId');
$refundReturnOrders=$refundReturnDao->convertCommonList($refundOrders,'refundId');
$refundOrderIds=array_column($refundOrders, 'orderId');
}
if(!empty($refundOrderIds)){
$orderIds=array_merge($refundOrderIds,$orderIds);
}
// $orderIds = array_column($qmDeliveryLogList['list'], 'orderId');
// echo json_encode($orderIds);exit; // echo json_encode($orderIds);exit;
// $where['delete_state'] = ApiConst::undeleteOrder; // $where['delete_state'] = ApiConst::undeleteOrder;
...@@ -901,14 +920,20 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -901,14 +920,20 @@ class OrderServiceModel extends \Business\AbstractModel
$goodsDao = \DAO\GoodsModel::getInstance(); $goodsDao = \DAO\GoodsModel::getInstance();
$orderIds = array_column($orders['list'], 'orderId'); $orderIds = array_column($orders['list'], 'orderId');
$orderCommons = $orderCommonDao->getAllByOrderIdsCache($orderIds, $diliverymanId, $orderCommonDao->orderCommonField); $orderCommons = $orderCommonDao->getAllByOrderIdsCache($orderIds, $diliverymanId, $orderCommonDao->orderCommonField);
$orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderIds, $this->getGoodsDetailField()), \Our\ApiConst::oneDaySecond, array($diliverymanId.'_')); $orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderIds, $this->getGoodsDetailField()), \Our\ApiConst::oneDaySecond, array($diliverymanId.'_'));
$orderMerge = Common::intergrateOneToMany($orders['list'], $orderGoods, 'orderId', 'orderId', 'orderGoods'); $orderMerge = Common::intergrateOneToMany($orders['list'], $orderGoods, 'orderId', 'orderId', 'orderGoods');
$orderMerge = Common::intergrateOneToOne($orderMerge, $orderCommons, 'orderId', 'orderId'); $orderMerge = Common::intergrateOneToOne($orderMerge, $orderCommons, 'orderId', 'orderId');
$orderMerge = $orderDao->convertOrderList($orderMerge); $orderMerge = $orderDao->convertOrderList($orderMerge);
$convertResult = array(); $convertResult = array();
//$orderGoods = $goodsDao->convert($orderGoods); //$orderGoods = $goodsDao->convert($orderGoods);
foreach ($qmDeliveryLogList['list'] as &$value) { foreach ($qmDeliveryLogList['list'] as &$value) {
if($value['orderType']==ApiConst::orderTypeRefund){
$delivery=$orderMerge[$refundReturnOrders[$value['orderId']]['orderId']];
}else{
$delivery = $orderMerge[$value['orderId']]; $delivery = $orderMerge[$value['orderId']];
}
$delivery['id'] = $value['id']; $delivery['id'] = $value['id'];
$delivery['reciverInfo'] = unserialize($delivery['reciverInfo']); $delivery['reciverInfo'] = unserialize($delivery['reciverInfo']);
$delivery['mobPhone'] = $delivery['reciverInfo']['mob_phone']; $delivery['mobPhone'] = $delivery['reciverInfo']['mob_phone'];
...@@ -916,7 +941,14 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -916,7 +941,14 @@ class OrderServiceModel extends \Business\AbstractModel
$delivery['finishTime'] = $value['finishTime']; $delivery['finishTime'] = $value['finishTime'];
$delivery['mobPhone'] = $delivery['mobPhone'] ? $delivery['mobPhone'] : ''; $delivery['mobPhone'] = $delivery['mobPhone'] ? $delivery['mobPhone'] : '';
$delivery['finishTime'] = $delivery['finishTime'] ? $delivery['finishTime'] : ApiConst::zero; $delivery['finishTime'] = $delivery['finishTime'] ? $delivery['finishTime'] : ApiConst::zero;
if($value['orderType']==ApiConst::orderTypeRefund){
//因为$value['orderId']=refundId
$orderMergeGoods=$goodsDao->convert($orderMerge[$refundReturnOrders[$value['orderId']]['orderId']]['orderGoods'],false,$refundOrders);
$delivery['orderGoods'] =$orderMergeGoods?$orderMergeGoods:array();
}else{
$delivery['orderGoods'] = !empty($goodsDao->convert($orderMerge[$value['orderId']]['orderGoods']))?$goodsDao->convert($orderMerge[$value['orderId']]['orderGoods']):array(); $delivery['orderGoods'] = !empty($goodsDao->convert($orderMerge[$value['orderId']]['orderGoods']))?$goodsDao->convert($orderMerge[$value['orderId']]['orderGoods']):array();
}
$delivery['street'] =$orderCommonDao->convertReceiveAddress($delivery['reciverInfo']['address']); $delivery['street'] =$orderCommonDao->convertReceiveAddress($delivery['reciverInfo']['address']);
$delivery['lng'] = $delivery['reciverInfo']['lng'] ? $delivery['reciverInfo']['lng'] : 0.0; $delivery['lng'] = $delivery['reciverInfo']['lng'] ? $delivery['reciverInfo']['lng'] : 0.0;
$delivery['lat'] = $delivery['reciverInfo']['lat'] ? $delivery['reciverInfo']['lat'] : 0.0; $delivery['lat'] = $delivery['reciverInfo']['lat'] ? $delivery['reciverInfo']['lat'] : 0.0;
...@@ -970,6 +1002,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -970,6 +1002,7 @@ class OrderServiceModel extends \Business\AbstractModel
$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);
$refundReturnDao=\DAO\Order\RefundReturnModel::getInstance();
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName); $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName);
$diliverymanDao = \DAO\Order\DiliverymanModel::getInstance(DbNameConst::salveDBConnectName); $diliverymanDao = \DAO\Order\DiliverymanModel::getInstance(DbNameConst::salveDBConnectName);
$goodsDao = \DAO\GoodsModel::getInstance(DbNameConst::salveDBConnectName); $goodsDao = \DAO\GoodsModel::getInstance(DbNameConst::salveDBConnectName);
...@@ -979,7 +1012,13 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -979,7 +1012,13 @@ class OrderServiceModel extends \Business\AbstractModel
if (empty($delivery)) { if (empty($delivery)) {
ErrorModel::throwException(CodeConfigModel::notExsitDeliver); ErrorModel::throwException(CodeConfigModel::notExsitDeliver);
} }
if($delivery['orderType']==ApiConst::orderTypeRefund){
$refundReturn=$refundReturnDao->findByRefundId($delivery['orderId'],$refundReturnDao->refundDetailField);
$orderId = $refundReturn['orderId'];
}else{
$orderId = $delivery['orderId']; $orderId = $delivery['orderId'];
}
//订单 //订单
$order = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderDao, 'findByOrderId'), array($orderId), \Our\ApiConst::oneDaySecond,array($orderId)); $order = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderDao, 'findByOrderId'), array($orderId), \Our\ApiConst::oneDaySecond,array($orderId));
...@@ -998,11 +1037,11 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -998,11 +1037,11 @@ class OrderServiceModel extends \Business\AbstractModel
if (empty($this->orderGoodsList)) { if (empty($this->orderGoodsList)) {
ErrorModel::throwException(CodeConfigModel::notExistOrderGoods); ErrorModel::throwException(CodeConfigModel::notExistOrderGoods);
} }
//商店相关信息 //商店相关信息
$this->store = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$storeDao, 'getInfoById'), array($this->order['storeId'],$storeDao->detailField), \Our\ApiConst::oneDaySecond); $this->store = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$storeDao, 'getInfoById'), array($this->order['storeId'],$storeDao->detailField), \Our\ApiConst::oneDaySecond);
$orderGoods = $goodsDao->convert($this->orderGoodsList); $convertRefundReturn=Array();
$convertRefundReturn[$refundReturn['orderGoodsId']]=$refundReturn;
$orderGoods = $goodsDao->convert($this->orderGoodsList,false,$convertRefundReturn);
if (empty($orderGoods)) { if (empty($orderGoods)) {
$orderGoods = array(); $orderGoods = array();
} }
......
...@@ -122,7 +122,6 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -122,7 +122,6 @@ class RefundServiceModel extends \Business\AbstractModel
// if (($refund['seller_state'] != '2' && $refund['platform_state'] != '1') || $refund['goods_state'] != '2') {//检查状态,防止页面刷新不及时造成数据错误 // if (($refund['seller_state'] != '2' && $refund['platform_state'] != '1') || $refund['goods_state'] != '2') {//检查状态,防止页面刷新不及时造成数据错误
// return false; // return false;
// } // }
error_reporting(E_ALL);
$refund_array = array(); $refund_array = array();
if ($goodsState == '3' && $delay_time > 0) { if ($goodsState == '3' && $delay_time > 0) {
$refund_array['goods_state'] = 3; $refund_array['goods_state'] = 3;
...@@ -184,7 +183,22 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -184,7 +183,22 @@ class RefundServiceModel extends \Business\AbstractModel
$orderDao->deleteOrderCache($refund['buyer_id'], $refund['order_id'], $refund['store_id']); $orderDao->deleteOrderCache($refund['buyer_id'], $refund['order_id'], $refund['store_id']);
$storeDAO->deleteStoreRefundCache($refund['store_id'],$refund['order_id']); $storeDAO->deleteStoreRefundCache($refund['store_id'],$refund['order_id']);
$refundReturnDao->db->doCommit(); $refundReturnDao->db->doCommit();
$push=\Our\Push::getInstance();
$pushData=array('storeId'=>$order_info['storeId'],
'type'=>ApiConst::messageRefund,
'waitReceiveCount'=>ApiConst::zero,
'waitDeliveryCount'=>ApiConst::zero,
'waitGetCount'=>ApiConst::zero,
'orderCount'=>ApiConst::zero,
'waitRefundProccessCount'=>ApiConst::zero,
'waitRefundReceiveCount'=>ApiConst::reduceOne,
'refundCount'=>ApiConst::reduceOne,
'alertCount'=>ApiConst::zero,
'params'=>array('c'=>'shopkeeper',
'm'=>'orderDetail',
'refundId'=>$refund['refund_id']));
$push->addOneToClient($pushData);
$push->sendTcpMessage();
return true; return true;
} }
$refundReturnDao->db->doRollback(); $refundReturnDao->db->doRollback();
...@@ -195,7 +209,7 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -195,7 +209,7 @@ class RefundServiceModel extends \Business\AbstractModel
* 退货审核页 * 退货审核页
* *
*/ */
public function returnGoods($storeId,$refundId,$sellerState,$sellerMessage,$isGiveUp=ApiConst::zero) { public function returnGoods($storeId,$refundId,$sellerState,$refundAmount,$sellerMessage,$isGiveUp=ApiConst::zero) {
$refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::masterDBConnectName); $refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::masterDBConnectName);
$orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName); $orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName);
$orderGoodsDao=\DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName); $orderGoodsDao=\DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName);
...@@ -218,6 +232,13 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -218,6 +232,13 @@ class RefundServiceModel extends \Business\AbstractModel
$refund_array['seller_state'] =$sellerState;//卖家处理状态:1为待审核,2为同意,3为不同意 $refund_array['seller_state'] =$sellerState;//卖家处理状态:1为待审核,2为同意,3为不同意
$refund_array['seller_message'] =$sellerMessage; $refund_array['seller_message'] =$sellerMessage;
//如果卖家不同意退款回写is_refund //如果卖家不同意退款回写is_refund
if($return['refund_type']==ApiConst::refundTypeGoods && !$isGiveUp){
$waitRefundReceiveCount=ApiConst::one;
$refundCount=ApiConst::zero;
}else{
$waitRefundReceiveCount=ApiConst::zero;
$refundCount=ApiConst::reduceOne;
}
if ($refund_array['seller_state'] != '2'){ if ($refund_array['seller_state'] != '2'){
$orderGoodsUpdateData['is_refund']=ApiConst::zero; $orderGoodsUpdateData['is_refund']=ApiConst::zero;
$orderGoodsUpdateData['refund_state_name']=DescribeConst::sellerRefuseReturn; $orderGoodsUpdateData['refund_state_name']=DescribeConst::sellerRefuseReturn;
...@@ -227,13 +248,7 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -227,13 +248,7 @@ class RefundServiceModel extends \Business\AbstractModel
if(!$result){ if(!$result){
ErrorModel::throwException(CodeConfigModel::updateIsRefundFail); ErrorModel::throwException(CodeConfigModel::updateIsRefundFail);
} }
if($return['refund_type']==ApiConst::refundTypeGoods && $return['return_type']){
$waitRefundReceiveCount=ApiConst::one;
$refundCount=ApiConst::zero;
}else{
$waitRefundReceiveCount=ApiConst::zero;
$refundCount=ApiConst::reduceOne;
}
$push=\Our\Push::getInstance(); $push=\Our\Push::getInstance();
$pushData=array('storeId'=>$order_info['storeId'], $pushData=array('storeId'=>$order_info['storeId'],
'type'=>ApiConst::messageRefund, 'type'=>ApiConst::messageRefund,
...@@ -267,12 +282,14 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -267,12 +282,14 @@ class RefundServiceModel extends \Business\AbstractModel
$refund_array['return_type'] = '2';//退货类型:1为不用退货,2为需要退货 $refund_array['return_type'] = '2';//退货类型:1为不用退货,2为需要退货
$refund_array['goods_state']=2; $refund_array['goods_state']=2;
} elseif ($refund_array['seller_state'] == '3') { } elseif ($refund_array['seller_state'] == '3') {
$refund_array['refund_state'] = '3';//状态:1为处理中,2为待管理员处理,3为已完成 $refund_array['refund_state'] = '3';//状态:1为处理中,2为待管理员处理,3为已完成
} else { } else {
$refund_array['seller_state'] = '2'; $refund_array['seller_state'] = '2';
$refund_array['refund_state'] = '2'; $refund_array['refund_state'] = '2';
$refund_array['return_type'] = '1';//选择弃货 $refund_array['return_type'] = '1';//选择弃货
} }
$refund_array['refund_amount']=$refundAmount;
$state = $refundReturnDao->update($condition, $refund_array); $state = $refundReturnDao->update($condition, $refund_array);
if ($state) { if ($state) {
$sellerLogDao=\DAO\SellerLogModel::getInstance(DbNameConst::masterDBConnectName); $sellerLogDao=\DAO\SellerLogModel::getInstance(DbNameConst::masterDBConnectName);
...@@ -285,8 +302,8 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -285,8 +302,8 @@ class RefundServiceModel extends \Business\AbstractModel
'waitGetCount'=>ApiConst::zero, 'waitGetCount'=>ApiConst::zero,
'orderCount'=>ApiConst::zero, 'orderCount'=>ApiConst::zero,
'waitRefundProccessCount'=>ApiConst::reduceOne, 'waitRefundProccessCount'=>ApiConst::reduceOne,
'waitRefundReceiveCount'=>zero, 'waitRefundReceiveCount'=>$waitRefundReceiveCount,
'refundCount'=>ApiConst::reduceOne, 'refundCount'=>$refundCount,
'alertCount'=>ApiConst::zero, 'alertCount'=>ApiConst::zero,
'params'=>array('c'=>'shopkeeper', 'params'=>array('c'=>'shopkeeper',
'm'=>'orderDetail', 'm'=>'orderDetail',
...@@ -335,7 +352,7 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -335,7 +352,7 @@ class RefundServiceModel extends \Business\AbstractModel
$whereRefund['refund_id']= $refundId; $whereRefund['refund_id']= $refundId;
$refund = $refundReturnDao->find($whereRefund); $refund = $refundReturnDao->find($whereRefund);
if($refund['refund_type']==ApiConst::refundTypeGoods){ if($refund['refund_type']==ApiConst::refundTypeGoods){
if($this->returnGoods($storeId,$refundId,$seller_state,$text,$isGiveUp)){ if($this->returnGoods($storeId,$refundId,$refund['sellerState'],$refundAmount,$text,$isGiveUp)){
$refundReturnDao->deleteRefundCache($refund['buyer_id'], $refund['refund_id']); $refundReturnDao->deleteRefundCache($refund['buyer_id'], $refund['refund_id']);
$orderDao->deleteOrderCache($refund['buyer_id'],$refund['order_id'],$refund['store_id']); $orderDao->deleteOrderCache($refund['buyer_id'],$refund['order_id'],$refund['store_id']);
\Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$refundReturnDao, 'getList'), array(), array($refund['store_id'])); \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$refundReturnDao, 'getList'), array(), array($refund['store_id']));
...@@ -555,7 +572,8 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -555,7 +572,8 @@ class RefundServiceModel extends \Business\AbstractModel
$orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName); $orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$goodsDao=\DAO\GoodsModel::getInstance(DbNameConst::salveDBConnectName); $goodsDao=\DAO\GoodsModel::getInstance(DbNameConst::salveDBConnectName);
$diliverymanDao=\DAO\Order\DiliverymanModel::getInstance();
$qmDeliveryManLogDao=\DAO\Order\QmDeliverymanLogModel::getInstance();
$addressDao = \DAO\Order\DAddressModel::getInstance(DbNameConst::salveDBConnectName); $addressDao = \DAO\Order\DAddressModel::getInstance(DbNameConst::salveDBConnectName);
$orderCommonDao = \DAO\Order\OrderCommonModel::getInstance(); $orderCommonDao = \DAO\Order\OrderCommonModel::getInstance();
...@@ -589,8 +607,15 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -589,8 +607,15 @@ class RefundServiceModel extends \Business\AbstractModel
$orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByRecIds'), array($orderGoodsId, $this->refundOrderGoodsField), \Our\ApiConst::oneDaySecond, array($storeId)); $orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::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');
$refundIds=array_column($refundMerge,'refundId');
$diliveryWhere['order_id']=array('in',$refundIds);
$diliveryWhere['order_type']=ApiConst::orderTypeRefund;
$orderWhere['order_id']=array('in',$orderIds); $orderWhere['order_id']=array('in',$orderIds);
$orders = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$orderDao, 'getList'), array($orderWhere, $orderDao->getOrderDetailField(), ApiConst::zero, $pageSize), \Our\ApiConst::oneDaySecond, array($storeId)); $orders = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$orderDao, 'getList'), array($orderWhere, $orderDao->getOrderDetailField(), ApiConst::zero, $pageSize), \Our\ApiConst::oneDaySecond, array($storeId));
$qmDeliveryManLogWhere['order_id']=array('in',$refundIds);
$qmDeliveryManLogWhere['order_type']= ApiConst::orderTypeRefund;
$qmDeliveryManLogs=\Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$qmDeliveryManLogDao, 'getList'), array($qmDeliveryManLogWhere, $qmDeliveryManLogDao->fieldDetail,ApiConst::zero,$pageSize), \Our\ApiConst::oneDaySecond, array($storeId));
$qmDeliveryManLogs=$qmDeliveryManLogDao->convertListByField($qmDeliveryManLogs['list'],'orderId');
$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');
...@@ -610,6 +635,14 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -610,6 +635,14 @@ class RefundServiceModel extends \Business\AbstractModel
$extent=$orderDao->getClienOrderCommon($orders[$value['orderId']]); $extent=$orderDao->getClienOrderCommon($orders[$value['orderId']]);
$value=array_merge($value,$extent); $value=array_merge($value,$extent);
$goodGroup=unserialize($value['goodsGroup']); $goodGroup=unserialize($value['goodsGroup']);
if ($value['diliverymanId']) {
$diliverymanDao = \DAO\Order\DiliverymanModel::getInstance();
$res = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$diliverymanDao, 'findById'), array($value['diliverymanId']), \Our\ApiConst::oneDaySecond, array($value['diliverymanId']));
$value['deliveryman'] = $diliverymanDao->convert($res);
$value['deliveryman']['distributionFee']=$qmDeliveryManLogs[$value['refundId']]['distributionFee'];
}else{
$value['deliveryman']=new \stdClass();
}
$value['goodsGroup']=!empty($goodGroup)?$goodGroup:[]; $value['goodsGroup']=!empty($goodGroup)?$goodGroup:[];
if ($value['refundType'] == ApiConst::refundTypeGoods) { if ($value['refundType'] == ApiConst::refundTypeGoods) {
if($value['refundShippingType']==ApiConst::bySeller){ if($value['refundShippingType']==ApiConst::bySeller){
......
...@@ -33,11 +33,19 @@ class DeliveryServiceModel extends \Business\AbstractModel ...@@ -33,11 +33,19 @@ class DeliveryServiceModel extends \Business\AbstractModel
{ {
$orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName); $orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName);
$storeDao=\DAO\StoreModel::getInstance(); $storeDao=\DAO\StoreModel::getInstance();
$refundReturnDao=\DAO\Order\RefundReturnModel::getInstance(DbNameConst::masterDBConnectName);
$qmDeliveryManLog = \DAO\Order\QmDeliverymanLogModel::getInstance(DbNameConst::masterDBConnectName); $qmDeliveryManLog = \DAO\Order\QmDeliverymanLogModel::getInstance(DbNameConst::masterDBConnectName);
$messageService=\Business\Message\MessageServiceModel::getInstance(); $messageService=\Business\Message\MessageServiceModel::getInstance();
$deliveryManDao=\DAO\Order\DiliverymanModel::getInstance(); $deliveryManDao=\DAO\Order\DiliverymanModel::getInstance();
$orderDao->setDb($orderDao->dbName); $orderDao->setDb($orderDao->dbName);
if($data['orderType']==ApiConst::orderTypeRefund){
//如果是退货orderId就是refundId
$orderOne= $refundReturnDao->findByRefundId($data['orderId'],$refundReturnDao->refundDetailField);
$orderD= $orderDao->find($orderOne['orderId'],$orderDao->getOrderDetailField());
}else{
$orderD= $orderDao->find($data['orderId'],$orderDao->getOrderDetailField()); $orderD= $orderDao->find($data['orderId'],$orderDao->getOrderDetailField());
}
// if( $orderD['diliveryman_id']== $data['id']){ // if( $orderD['diliveryman_id']== $data['id']){
// ErrorModel::throwException(CodeConfigModel::alreadyExsitQmDeliveryLog); // ErrorModel::throwException(CodeConfigModel::alreadyExsitQmDeliveryLog);
// } // }
...@@ -46,12 +54,18 @@ class DeliveryServiceModel extends \Business\AbstractModel ...@@ -46,12 +54,18 @@ class DeliveryServiceModel extends \Business\AbstractModel
// } // }
$orderDao->db->doTransaction(); $orderDao->db->doTransaction();
$orderData['diliveryman_id'] = $data['id']; $orderData['diliveryman_id'] = $data['id'];
if($data['orderType']==ApiConst::orderTypeRefund){
$returnWhere['refund_id']=$data['orderId'];
$orderRes= $refundReturnDao->update($returnWhere,$orderData);
}else{
$orderData['order_state']=ApiConst::orderStateWaitRecieve; $orderData['order_state']=ApiConst::orderStateWaitRecieve;
$orderRes = $orderDao->updateByOrderId($orderData, $data['orderId']); $orderRes = $orderDao->updateByOrderId($orderData, $data['orderId']);
// if (!$orderRes) { }
// $orderDao->db->doRollback();
// ErrorModel::throwException(CodeConfigModel::updateOrderFail); if ($orderRes===false) {
// } $orderDao->db->doRollback();
ErrorModel::throwException(CodeConfigModel::updateOrderFail);
}
$qmDeliveryManLogData['diliveryman_id'] = $data['id']; $qmDeliveryManLogData['diliveryman_id'] = $data['id'];
$qmDeliveryManLogData['store_id'] = $data['storeId']; $qmDeliveryManLogData['store_id'] = $data['storeId'];
$qmDeliveryManLogData['order_id'] = $data['orderId']; $qmDeliveryManLogData['order_id'] = $data['orderId'];
...@@ -86,6 +100,7 @@ class DeliveryServiceModel extends \Business\AbstractModel ...@@ -86,6 +100,7 @@ class DeliveryServiceModel extends \Business\AbstractModel
$deliveryManMemberIds=array($deliveryManMemberId,$oringeDeliveryManMemberId); $deliveryManMemberIds=array($deliveryManMemberId,$oringeDeliveryManMemberId);
$orderDao->deleteOrderCache(null, $data['orderId'], $data['storeId'], true,false,$deliveryManMemberIds); $orderDao->deleteOrderCache(null, $data['orderId'], $data['storeId'], true,false,$deliveryManMemberIds);
$storeDao->deleteStoreCache($data['storeId'],$data['orderId']); $storeDao->deleteStoreCache($data['storeId'],$data['orderId']);
$storeDao->deleteStoreRefundCache($data['storeId'],$data['orderId']);
//配送员推送 //配送员推送
$push=\Our\Push::getInstance(); $push=\Our\Push::getInstance();
$push->sendDelivery($oringeDeliveryManMemberId,$data['orderId']); $push->sendDelivery($oringeDeliveryManMemberId,$data['orderId']);
......
...@@ -171,7 +171,6 @@ class MemberCenterServiceModel extends \Business\AbstractModel ...@@ -171,7 +171,6 @@ class MemberCenterServiceModel extends \Business\AbstractModel
$list = $favoritesInstance->getFavoritesStores(array('member_id'=>$memberId,'fav_type'=>1),'fav_from,store_id,favid'); $list = $favoritesInstance->getFavoritesStores(array('member_id'=>$memberId,'fav_type'=>1),'fav_from,store_id,favid');
$brandsAround = []; $brandsAround = [];
$concernedShops = []; $concernedShops = [];
$returnStores = [];
if($list) { if($list) {
$storeIds = array_column($list,'store_id'); $storeIds = array_column($list,'store_id');
$storeIds = implode(',',$storeIds); $storeIds = implode(',',$storeIds);
...@@ -188,10 +187,9 @@ class MemberCenterServiceModel extends \Business\AbstractModel ...@@ -188,10 +187,9 @@ class MemberCenterServiceModel extends \Business\AbstractModel
}elseif($v['fav_from'] == 3){ }elseif($v['fav_from'] == 3){
$brandsAround[] = $tempStore; $brandsAround[] = $tempStore;
} }
$returnStores[] = $tempStore;
} }
} }
return array('concernedShop'=>$concernedShops,'brandsAround'=>$brandsAround,'stores'=>$returnStores,'totalCount'=>count($stores)); return array('concernedShop'=>$concernedShops,'brandsAround'=>$brandsAround,'totalCount'=>count($stores));
} }
/** /**
......
...@@ -39,25 +39,40 @@ class SalespersonServiceModel extends \Business\AbstractModel ...@@ -39,25 +39,40 @@ class SalespersonServiceModel extends \Business\AbstractModel
$acts = $this->getOrderGoods($acts,$saleGoods,$memberId); $acts = $this->getOrderGoods($acts,$saleGoods,$memberId);
return $acts; return $acts;
} }
/**
* @param $acts
* @param $saleGoods goods_id 或 array('goods_id'=>'sale_act_id')
* @param $memberId
* @return array
* @throws \Exception
* @throws \Our\Exception
*/
protected function getOrderGoods($acts,$saleGoods,$memberId){ protected function getOrderGoods($acts,$saleGoods,$memberId){
if(is_array($acts)) { if(is_array($acts)) {
//多个活动
$tempActs = array_column($acts['list'],'qrcode_path','sale_act_id'); $tempActs = array_column($acts['list'],'qrcode_path','sale_act_id');
if($saleGoods) {
$goodsIds = array_keys($saleGoods);
}else{
$goodsIds = [];
}
}else{ }else{
//单个活动
$saleActArr = array($acts); $saleActArr = array($acts);
$sale = \DAO\SaleModel::getInstance()->getOne(array('sale_act_id'=>$acts,'member_id'=>$memberId,'is_closing'=>0),'qrcode_path'); $sale = \DAO\SaleModel::getInstance()->getOne(array('sale_act_id'=>$acts,'member_id'=>$memberId,'is_closing'=>0),'qrcode_path');
if(!$sale) { if(!$sale) {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::saleNotJoin); \Error\ErrorModel::throwException(\Error\CodeConfigModel::saleNotJoin);
} }
$tempActs[$acts] = $sale['qrcode_path']; $tempActs[$acts] = $sale['qrcode_path'];
$goodsIds = array($saleGoods);
$saleGoods = array($saleGoods=>$acts); $saleGoods = array($saleGoods=>$acts);
} }
$saleActArr = array_keys($tempActs); $saleActArr = array_keys($tempActs);
$saleOrderDAO = \DAO\SaleOrderModel::getInstance();
//取得goodsid 防止活动商品表的商品被删除 显示的商品不准确
$saleGoodsList = \Our\RedisHelper::cachedFunction(\Redis\Db1\SaleOrderRedisModel::getInstance(),array(&$saleOrderDAO, 'getOrderGoodsList'),array("sale_act_id in(".implode(',',$saleActArr).") AND sale_id = {$memberId}",'DISTINCT goods_id,sale_act_id'),\Our\ApiConst::halfDaySecond,array($memberId));
$saleGoodsList = $saleGoodsList ? array_column($saleGoodsList,'sale_act_id','goods_id') : [];
$saleGoods = $saleGoods +$saleGoodsList;
$goodsIds = $saleGoods ? array_keys($saleGoods) :[];
if($goodsIds) { if($goodsIds) {
$goodsDAO = \DAO\GoodsModel::getInstance(); $goodsDAO = \DAO\GoodsModel::getInstance();
$tempGoodsList = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$goodsDAO, 'getList'),array('goods_id in('.implode(',',$goodsIds).')','goods_id,goods_commonid,goods_name,goods_image'),\Our\ApiConst::oneMinute); $tempGoodsList = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$goodsDAO, 'getList'),array('goods_id in('.implode(',',$goodsIds).')','goods_id,goods_commonid,goods_name,goods_image'),\Our\ApiConst::oneMinute);
...@@ -70,7 +85,7 @@ class SalespersonServiceModel extends \Business\AbstractModel ...@@ -70,7 +85,7 @@ class SalespersonServiceModel extends \Business\AbstractModel
$goodsList[$v['goods_id']] = $v; $goodsList[$v['goods_id']] = $v;
} }
} }
$saleOrderDAO = \DAO\SaleOrderModel::getInstance();
$saleActDAO = \DAO\SaleActivityModel::getInstance(); $saleActDAO = \DAO\SaleActivityModel::getInstance();
$actList = $saleActDAO->getActByArr($saleActArr); $actList = $saleActDAO->getActByArr($saleActArr);
......
...@@ -28,6 +28,13 @@ abstract class AbstractModel { ...@@ -28,6 +28,13 @@ abstract class AbstractModel {
$this->db=LinkMySQLModel::get($dbLink); $this->db=LinkMySQLModel::get($dbLink);
} }
} }
public function convertCommonList($list,$filed){
$returnList=Array();
foreach($list as $li){
$returnList[$li[$filed]]=$li;
}
return $returnList;
}
public function unsetDb(){ public function unsetDb(){
unset($this->db); unset($this->db);
// LinkMySQLModel::unsetDbConecet(); // LinkMySQLModel::unsetDbConecet();
......
...@@ -473,7 +473,16 @@ class GoodsModel extends \DAO\AbstractModel { ...@@ -473,7 +473,16 @@ class GoodsModel extends \DAO\AbstractModel {
return $orderGoodses; return $orderGoodses;
} }
//ccw //ccw
public function convert($goodses,$extentField=false){ public function convert($goodses,$extentField=false,$refundOrders=false){
if($refundOrders){
$newGoods=Array();
foreach($goodses as $goods){
if($refundOrders[$goods['recId']]){
array_push($newGoods,$goods);
}
}
$goodses=$newGoods;
}
foreach($goodses as &$goods){ foreach($goodses as &$goods){
if($goods['refundId']==ApiConst::zero){ if($goods['refundId']==ApiConst::zero){
if((!empty($extentField) || empty($goods['refundStateName'])) ){ if((!empty($extentField) || empty($goods['refundStateName'])) ){
......
...@@ -274,6 +274,7 @@ class OrderModel extends \DAO\AbstractModel ...@@ -274,6 +274,7 @@ class OrderModel extends \DAO\AbstractModel
$where = $this->db->getSqlWhereByArray($where); $where = $this->db->getSqlWhereByArray($where);
if($status==ApiConst::orderStateComplete){ if($status==ApiConst::orderStateComplete){
$data['is_receive_payment']=ApiConst::receivePayment; $data['is_receive_payment']=ApiConst::receivePayment;
$data['payment_time']=TIMESTAMP;
} }
$data['order_state'] = $status; $data['order_state'] = $status;
$data['finnshed_time']=TIMESTAMP; $data['finnshed_time']=TIMESTAMP;
......
...@@ -16,8 +16,9 @@ use Our\ImageConst; ...@@ -16,8 +16,9 @@ use Our\ImageConst;
class QmDeliverymanLogModel extends \DAO\AbstractModel class QmDeliverymanLogModel extends \DAO\AbstractModel
{ {
public $fieldList = 'id,finish_time finishTime,get_time as getTime,order_id as orderId,distribution_fee as distributionFee'; public $fieldList = 'id,finish_time finishTime,get_time as getTime,order_id as orderId,distribution_fee as distributionFee,order_type as orderType,distribution_fee as distributionFee,shipping_fee as shippingFee,order_sn as orderSn';
public $fieldDetail = 'id,finish_time finishTime,get_time as getTime,order_id as orderId,delivery_state as deliveryState,order_type as orderType,distribution_fee as distributionFee'; public $fieldDetail = 'id,finish_time finishTime,get_time as getTime,order_id as orderId,delivery_state as deliveryState,order_type as orderType,distribution_fee as distributionFee,shipping_fee as shippingFee,order_sn as orderSn';
/** /**
...@@ -180,6 +181,15 @@ class QmDeliverymanLogModel extends \DAO\AbstractModel ...@@ -180,6 +181,15 @@ class QmDeliverymanLogModel extends \DAO\AbstractModel
return $convertInfo; return $convertInfo;
} }
public function convertListByField($list,$field='orderId'){
$returnList=Array();
foreach($list as $li){
$returnList[$li[$field]]=$li;
}
return $returnList;
}
//删除订单详情缓存 //删除订单详情缓存
public function deletefindByIdCache($id) public function deletefindByIdCache($id)
{ {
......
...@@ -538,6 +538,9 @@ class RefundReturnModel extends \DAO\AbstractModel { ...@@ -538,6 +538,9 @@ class RefundReturnModel extends \DAO\AbstractModel {
public function getList($where, $field, $pageIndex=ApiConst::zero, $pageSize=ApiConst::pageSize, $order = array('add_time' => 'desc')) public function getList($where, $field, $pageIndex=ApiConst::zero, $pageSize=ApiConst::pageSize, $order = array('add_time' => 'desc'))
{ {
$this->setDb($this->dbName); $this->setDb($this->dbName);
if(is_array($where)){
$where = $this->db->getSqlWhereByArray($where);
}
$refunds = $this->lists($where, $order, $field, $pageIndex, $pageSize); $refunds = $this->lists($where, $order, $field, $pageIndex, $pageSize);
return $refunds ? $refunds : array(); return $refunds ? $refunds : array();
} }
......
...@@ -748,7 +748,7 @@ class CodeConfigModel ...@@ -748,7 +748,7 @@ class CodeConfigModel
self::confirmReceiveError => '确认收款失败', self::confirmReceiveError => '确认收款失败',
self::alreadyExsitDeliveryMan=>'您的店铺已经存在此配送员', self::alreadyExsitDeliveryMan=>'您的店铺已经存在此配送员',
self::alreadyExsitQmDeliveryLog=>'已经分配此配送员', self::alreadyExsitQmDeliveryLog=>'已经分配此配送员',
self::notExsitDeliveryMan=>'用户不存在或未绑定手机号码', self::notExsitDeliveryMan=>'您输入的手机号不存在,请先通知配送员注册【我的身边店】',
self::addDeliveryManError=>'添加配送员失败', self::addDeliveryManError=>'添加配送员失败',
self::noStorageForBundlingGoods => '组合销售商品库存不存在', self::noStorageForBundlingGoods => '组合销售商品库存不存在',
self::bundlingGoodsOfflineForCartOrOrder => '组合销售活动已下架', self::bundlingGoodsOfflineForCartOrOrder => '组合销售活动已下架',
......
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