Commit aab735a3 authored by liuyuzhen's avatar liuyuzhen

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

parents 990146ea 1ff618bc
......@@ -169,7 +169,7 @@ class Push
$this->pushMessage($id,$this->orderId,$toId,$this->orderId,$toUserId,$this->orderName,$member['memberName'],ApiConst::orderMessageType,ApiConst::memberMessageType,$fromAvatar,$message);
}
//配送提醒
public function deliveryRemind($toId,$orderId)
public function deliveryRemind($toId,$orderId,$orderGoodsId=false)
{
$memberDao = \DAO\MemberModel::getInstance();
$member = $memberDao->getInfo($toId);
......@@ -177,20 +177,25 @@ class Push
$toUserId=$toId;
$orderService=\Business\Order\OrderServiceModel::getInstance();
$orderDetail=$orderService->getOrderDetail($orderId);
if($orderGoodsId){
$orderGoodsDao=\DAO\Order\OrderGoodsModel::getInstance();
$orderDetail['orderGoods']= $orderGoodsDao->convertRefundOrderGoods($orderDetail['orderGoods'],$orderGoodsId);
}
$messageContent=$this->getOrderMessageContent($orderDetail);
$href=Common::format(PathConst::orderId,$orderId);
$fromAvatar=Common::getStaticFile(ImageConst::orderAvatarName, ImageConst::systemAvatar);
// $buttons=$this->getRecieveButtons($orderId);
// $buttons=$this->getRecieveButtons($orderId);
$message=$this->getMessageTemplate(ApiConst::deliveryOrderType,DescribeConst::deliveryRemindTitle,$messageContent,'','',$href,ApiConst::zero);
$id = time() . (string)$this->orderIdStr.$orderId;
$this->pushMessage($id,\Our\MemberIdConst::deliveryId,$toId,\Our\MemberIdConst::deliveryId,$toUserId,\Our\MemberIdConst::deliveryMessageName,$member['memberName'],ApiConst::orderMessageType,ApiConst::deliveryUserMessageType,$fromAvatar,$message);
}
public function sendDelivery($toId,$orderId){
$this->deliveryRemind($toId,$orderId);
public function sendDelivery($toId,$orderId,$orderGoodsId=false){
$this->deliveryRemind($toId,$orderId,$orderGoodsId);
$this->sendTcpMessage();
}
private function getButton($buttonType,$name,$buttonId,$params){
return array(
return array(
'type'=>$buttonType,
'name'=>$name,
'status'=>ApiConst::messageButoonNotClick,
......@@ -209,10 +214,10 @@ class Push
}
//确认接单按钮
private function getComfirmRecieveButtons($orderId){
$buttons=array();
$button=$this->getButton(ApiConst::messageButtonTypeReciverButton,DescribeConst::recieveButton,ApiConst::messageButtonIdOne,array('orderId'=>$orderId));
array_push($buttons,$button);
return $buttons;
$buttons=array();
$button=$this->getButton(ApiConst::messageButtonTypeReciverButton,DescribeConst::recieveButton,ApiConst::messageButtonIdOne,array('orderId'=>$orderId));
array_push($buttons,$button);
return $buttons;
}
public function getOrderMessageContent($orderDetail){
......@@ -261,7 +266,7 @@ class Push
}
$message['data'] = $this->data;
$message['uid'] = !empty($this->uid)?$this->uid:ApiConst::zero;
// $message['data']=array_slice($message['data'],2,14);
// $message['data']=array_slice($message['data'],2,14);
$message = json_encode($message);
$key=md5($message);
$redis->set($key,$message);
......
......@@ -990,7 +990,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
\DAO\SaleOrderModel::getInstance(\Our\DbNameConst::masterDBConnectName)->insert($insert);
}
$saleOrderDAO = \DAO\SaleOrderModel::getInstance();
\Our\RedisHelper::delCachedFunction(\Redis\Db1\MemberCouponRedisModel::getInstance(), array(&$saleOrderDAO, 'getOrderGoodsList'),array(),array($orderGoods['buyer_id']));
\Our\RedisHelper::delCachedFunction(\Redis\Db1\SaleOrderRedisModel::getInstance(), array(&$saleOrderDAO, 'getOrderGoodsList'),array(),array($orderGoods['sale_id']));
}
$pageBegin++;
} while (!empty($orders['list']));
......
......@@ -1041,7 +1041,12 @@ class OrderServiceModel extends \Business\AbstractModel
$this->store = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$storeDao, 'getInfoById'), array($this->order['storeId'],$storeDao->detailField), \Our\ApiConst::oneDaySecond);
$convertRefundReturn=Array();
$convertRefundReturn[$refundReturn['orderGoodsId']]=$refundReturn;
$orderGoods = $goodsDao->convert($this->orderGoodsList,false,$convertRefundReturn);
if($delivery['orderType']==ApiConst::orderTypeRefund){
$orderGoods = $goodsDao->convert($this->orderGoodsList,false,$convertRefundReturn);
}else{
$orderGoods=$goodsDao->convert($this->orderGoodsList);
}
if (empty($orderGoods)) {
$orderGoods = array();
}
......
......@@ -184,7 +184,7 @@ class RefundServiceModel extends \Business\AbstractModel
$storeDAO->deleteStoreRefundCache($refund['store_id'],$refund['order_id']);
$refundReturnDao->db->doCommit();
$push=\Our\Push::getInstance();
$pushData=array('storeId'=>$order_info['storeId'],
$pushData=array('storeId'=>$storeId,
'type'=>ApiConst::messageRefund,
'waitReceiveCount'=>ApiConst::zero,
'waitDeliveryCount'=>ApiConst::zero,
......@@ -226,29 +226,32 @@ class RefundServiceModel extends \Business\AbstractModel
if(!$return_goods) {
ErrorModel::throwException(CodeConfigModel::wrongRefundState);
}
$orderDao->setDb(DbNameConst::masterDBConnectName);
$orderDao->db->doTransaction();
$order_info=$orderDao->findByOrderId($return['order_id'],$orderDao->getOrderDetailField());
$refund_array = array();
$refund_array['seller_time'] = TIMESTAMP;
$refund_array['seller_state'] =$sellerState;//卖家处理状态:1为待审核,2为同意,3为不同意
$refund_array['seller_message'] =$sellerMessage;
//如果卖家不同意退款回写is_refund
if($return['refund_type']==ApiConst::refundTypeGoods && !$isGiveUp){
if($return['refund_type']==ApiConst::refundTypeGoods && !$isGiveUp && $sellerState==ApiConst::refundSellerAgree){
$waitRefundReceiveCount=ApiConst::one;
$refundCount=ApiConst::zero;
}else{
$waitRefundReceiveCount=ApiConst::zero;
$refundCount=ApiConst::reduceOne;
}
if ($refund_array['seller_state'] != '2'){
//如果卖家不同意退款回写is_refund
if ($sellerState != '2'){
$orderGoodsUpdateData['is_refund']=ApiConst::zero;
$orderGoodsUpdateData['refund_state_name']=DescribeConst::sellerRefuseReturn;
$orderGoodsUpdateData['gmt_update']=TIMESTAMP;
$orderGoodsWhere['rec_id']=$return['order_goods_id'];
$result=$orderGoodsDao->update($orderGoodsWhere,$orderGoodsUpdateData);
if(!$result){
$orderDao->db->doRollback();
ErrorModel::throwException(CodeConfigModel::updateIsRefundFail);
}
$push=\Our\Push::getInstance();
$pushData=array('storeId'=>$order_info['storeId'],
'type'=>ApiConst::messageRefund,
......@@ -265,7 +268,6 @@ class RefundServiceModel extends \Business\AbstractModel
'refundId'=>$return['refund_id']));
$push->addOneToClient($pushData);
$push->sendTcpMessage();
}
if ($refund_array['seller_state'] == ApiConst::refundSellerAgree){
......@@ -274,6 +276,7 @@ class RefundServiceModel extends \Business\AbstractModel
$orderGoodsWhere['rec_id']=$return['order_goods_id'];
$result=$orderGoodsDao->update($orderGoodsWhere,$orderGoodsUpdateData);
if(!$result){
$orderDao->db->doRollback();
ErrorModel::throwException(CodeConfigModel::updateRefundStateNameFail);
}
}
......@@ -294,6 +297,7 @@ class RefundServiceModel extends \Business\AbstractModel
if ($state) {
$sellerLogDao=\DAO\SellerLogModel::getInstance(DbNameConst::masterDBConnectName);
$sellerLogDao->record('退货处理,退货编号:'.$return['refund_sn']);
$orderDao->db->doCommit();
$push=\Our\Push::getInstance();
$pushData=array('storeId'=>$order_info['storeId'],
'type'=>ApiConst::messageRefund,
......@@ -352,7 +356,7 @@ class RefundServiceModel extends \Business\AbstractModel
$whereRefund['refund_id']= $refundId;
$refund = $refundReturnDao->find($whereRefund);
if($refund['refund_type']==ApiConst::refundTypeGoods){
if($this->returnGoods($storeId,$refundId,$refund['sellerState'],$refundAmount,$text,$isGiveUp)){
if($this->returnGoods($storeId,$refundId,$seller_state,$refundAmount,$text,$isGiveUp)){
$refundReturnDao->deleteRefundCache($refund['buyer_id'], $refund['refund_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']));
......@@ -477,8 +481,23 @@ class RefundServiceModel extends \Business\AbstractModel
$refundReturnDao->deleteRefundCache($refund['buyer_id'], $refund['refund_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']));
$storeDao->deleteStoreCache($refund['store_id'],$refund['order_id']);
$storeDao->deleteStoreRefundCache($refund['store_id'],$refund['order_id']);
$storeDao->deleteStoreCache($storeId,$refund['order_id']);
$storeDao->deleteStoreRefundCache($storeId,$refund['order_id']);
$push=\Our\Push::getInstance();
$pushData=array('storeId'=>$storeId,
'type'=>ApiConst::messageRefund,
'waitReceiveCount'=>ApiConst::zero,
'waitDeliveryCount'=>ApiConst::zero,
'waitGetCount'=>ApiConst::zero,
'orderCount'=>ApiConst::zero,
'waitRefundProccessCount'=>ApiConst::reduceOne,
'waitRefundReceiveCount'=>ApiConst::zero,
'refundCount'=>ApiConst::zero,
'alertCount'=>ApiConst::zero,
'params'=>array('c'=>'shopkeeper',
'm'=>'orderDetail',
'refundId'=>$refund['refund_id']));
$push->addOneToClient($pushData);
return true;
}
$refundReturnDao->db->doRollback();
......
......@@ -41,9 +41,11 @@ class DeliveryServiceModel extends \Business\AbstractModel
if($data['orderType']==ApiConst::orderTypeRefund){
//如果是退货orderId就是refundId
$orderOne= $refundReturnDao->findByRefundId($data['orderId'],$refundReturnDao->refundDetailField);
$orderD= $orderDao->find($orderOne['orderId'],$orderDao->getOrderDetailField());
$whereOrder['order_id']=$orderOne['orderId'];
$orderD= $orderDao->find($whereOrder,$orderDao->getOrderDetailField());
}else{
$orderD= $orderDao->find($data['orderId'],$orderDao->getOrderDetailField());
$whereOrder['order_id']=$data['orderId'];
$orderD= $orderDao->find($whereOrder,$orderDao->getOrderDetailField());
}
// if( $orderD['diliveryman_id']== $data['id']){
......@@ -103,7 +105,12 @@ class DeliveryServiceModel extends \Business\AbstractModel
$storeDao->deleteStoreRefundCache($data['storeId'],$data['orderId']);
//配送员推送
$push=\Our\Push::getInstance();
$push->sendDelivery($oringeDeliveryManMemberId,$data['orderId']);
if($data['orderType']==ApiConst::orderTypeRefund){
$push->sendDelivery($oringeDeliveryManMemberId,$orderD['orderId'],$orderOne['orderGoodsId']);
}else{
$push->sendDelivery($oringeDeliveryManMemberId,$orderD['orderId']);
}
$messageService->addMessageCenterToDb();
return $res;
}
......@@ -136,6 +143,8 @@ class DeliveryServiceModel extends \Business\AbstractModel
if(!$resData){
ErrorModel::throwException(CodeConfigModel::addDeliveryManError);
}
$memberDb0Redis=\Redis\Db0\MemberRedisModel::getInstance();
$memberDb0Redis->tableHSet(trim($member['diliveryman_id']),$resData,ApiConst::tenDaySecond);
return $resData;
}
......
......@@ -259,6 +259,15 @@ class OrderGoodsModel extends \DAO\AbstractModel {
return $res;
}
public function convertRefundOrderGoods($orderGoods,$orderGoodsId){
$newOrderGoods=Array();
foreach($orderGoods as $orderGood){
if($orderGood['recId']==$orderGoodsId){
array_push($newOrderGoods,$orderGood);
}
}
return $newOrderGoods;
}
/**
* 类实例
*
......
......@@ -37,6 +37,7 @@ class SaleOrderRedisModel extends \Redis\Db1\AbstractModel {
}
public function tableHSet($h,$key,$val,$experio=0){
return $this->hset($this->calcKey($h),$key,$val,$experio);
}
......@@ -52,7 +53,15 @@ class SaleOrderRedisModel extends \Redis\Db1\AbstractModel {
public function tableHMGet($h,$keyvalues){
return $this->hmget($this->calcKey($h),$keyvalues);
}
public function tableDelAll($data){
return $this->delAll($data);
}
public function tableKeys($prekey){
return $this->keys($this->calcKey($prekey));
}
public function tableDel($key){
return $this->del($key);
}
public function tableCacheGet($id){
$result = $this->get($this->calcKey($id));
return $result;
......
......@@ -260,7 +260,7 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
$refundAmount = floatval($this->req['data']['refundAmount']);
$text = trim($this->req['data']['text']);
$isGiveUp=$this->req['data']['isGiveUp']?$this->req['data']['isGiveUp']:\Our\ApiConst::zero;
$res = $refundService->refund($this->storeId, $this->sellerId, $this->sellerName, $refundId, $refundAmount, $text,\Our\ApiConst::refundSellerAgree,$isGiveUp);
$res = $refundService->refund($this->storeId, $this->sellerId, $this->sellerName, $refundId,$refundAmount, $text,\Our\ApiConst::refundSellerAgree,$isGiveUp);
if($res){
$this->success('操作成功');
}
......@@ -278,7 +278,7 @@ class ShopkeeperController extends \Our\Controller_AbstractClient {
}
$refundService=\Business\Order\RefundServiceModel::getInstance();
$text = trim($this->req['data']['text']);
$res = $refundService->refund($this->storeId, $this->sellerId, $this->sellerName, $refundId,0, $text, 3);
$res = $refundService->refund($this->storeId, $this->sellerId, $this->sellerName, $refundId,\Our\ApiConst::zero,$text,\Our\ApiConst::refundSellerRefuse);
$this->success($res);
}
......
......@@ -57,7 +57,7 @@ class cliRecommend extends basecli
echo '****create dir fail ****';
exit;
}
$this->lockFileName = $lockDir .'.locks';
$this->lockFileName = $lockDir .'/goodsRecommend.locks';
if( file_exists( $this->lockFileName ) )
{
$stat = stat($this->lockFileName);
......
......@@ -50,12 +50,12 @@ class cliOrderEvaluate extends basecli
echo "*** Debug mode ***\n";
}
// Step: 02 检查是否已有相同CLI在运行中
$lockDir=$this->_getBaseFileName('orderConfirm');
$lockDir=$this->_getBaseFileName('orderEvaluate');
if(!$this->mkdirs($lockDir)){
echo '****create dir fail ****';
exit;
}
$this->lockFileName = $lockDir . '/orderType_'. $this->orderType.'_orderResult_'.$this->orderResult. '.locks';
$this->lockFileName = $lockDir . '/orderEvaluate.locks';
if( file_exists( $this->lockFileName ) )
{
$stat = stat($this->lockFileName);
......
......@@ -55,7 +55,7 @@ class cliSaleOrder extends basecli
echo '****create dir fail ****';
exit;
}
$this->lockFileName = $lockDir .'.locks';
$this->lockFileName = $lockDir .'/orderSaleGoods.locks';
if( file_exists( $this->lockFileName ) )
{
$stat = stat($this->lockFileName);
......
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