Commit 8c6983e2 authored by wwccw0591's avatar wwccw0591

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

parents dea60ad2 349a96c3
...@@ -114,7 +114,6 @@ class CartController extends \Our\Controller_AbstractApi{ ...@@ -114,7 +114,6 @@ class CartController extends \Our\Controller_AbstractApi{
$gcIds = isset($cartList['gcIds'])?$cartList['gcIds']:array(); $gcIds = isset($cartList['gcIds'])?$cartList['gcIds']:array();
$storeCartData = array('cartList'=>$cartList['list'],'storeIds'=>$storeCartList['storeIds'],'goodsIds'=>$storeCartList['goodsIds'],'goodsCommonIds'=>$storeCartList['goodsCommonIds'],'blIds'=>$storeCartList['blIds'],'gcIds'=>$gcIds); $storeCartData = array('cartList'=>$cartList['list'],'storeIds'=>$storeCartList['storeIds'],'goodsIds'=>$storeCartList['goodsIds'],'goodsCommonIds'=>$storeCartList['goodsCommonIds'],'blIds'=>$storeCartList['blIds'],'gcIds'=>$gcIds);
//var_dump($storeCartData); //var_dump($storeCartData);
//$this->success($storeCartData);
$storeCartData = $cartService->checkCouponForCart($storeCartData,$this->memberId); $storeCartData = $cartService->checkCouponForCart($storeCartData,$this->memberId);
//$this->success($storeCartData); //$this->success($storeCartData);
$storeCartData = $cartService->getDeliveryTypeForCart($address,$storeCartData); $storeCartData = $cartService->getDeliveryTypeForCart($address,$storeCartData);
...@@ -138,6 +137,7 @@ class CartController extends \Our\Controller_AbstractApi{ ...@@ -138,6 +137,7 @@ class CartController extends \Our\Controller_AbstractApi{
$gcIds = isset($cartList['gcIds'])?$cartList['gcIds']:array(); $gcIds = isset($cartList['gcIds'])?$cartList['gcIds']:array();
$storeCartData = array('cartList'=>$cartList['list'],'storeIds'=>array_keys($cartList['list']),'goodsIds'=>$cartList['goodsIds'],'goodsCommonIds'=>$cartList['goodsCommonIds'],'blIds'=>$cartList['blIds'],'gcIds'=>$gcIds); $storeCartData = array('cartList'=>$cartList['list'],'storeIds'=>array_keys($cartList['list']),'goodsIds'=>$cartList['goodsIds'],'goodsCommonIds'=>$cartList['goodsCommonIds'],'blIds'=>$cartList['blIds'],'gcIds'=>$gcIds);
$storeCartData = $cartService->checkCouponForCart($storeCartData,$this->memberId); $storeCartData = $cartService->checkCouponForCart($storeCartData,$this->memberId);
//$this->success($storeCartData);
$storeCartData = $cartService->getDeliveryTypeForCart($address,$storeCartData); $storeCartData = $cartService->getDeliveryTypeForCart($address,$storeCartData);
$data = $cartService->getFormatCartListForOrder($storeCartData,$address); $data = $cartService->getFormatCartListForOrder($storeCartData,$address);
$this->success($data); $this->success($data);
......
...@@ -122,7 +122,11 @@ class MessageController extends \Our\Controller_AbstractApi { ...@@ -122,7 +122,11 @@ class MessageController extends \Our\Controller_AbstractApi {
\Error\ErrorModel::throwException(\Error\CodeConfigModel::receiveError); \Error\ErrorModel::throwException(\Error\CodeConfigModel::receiveError);
} }
} }
public function getUnreadCountAction(){
$messageService = \Business\Message\MessageServiceModel::getInstance();
$unreadCount=$messageService->getUnreadCountByMemberIdAndType($this->memberId);
$this->success(array('unreadCount'=>$unreadCount));
}
public function setAction(){ public function setAction(){
$messageService = \Business\Message\MessageServiceModel::getInstance(); $messageService = \Business\Message\MessageServiceModel::getInstance();
$type=$this->req['data']['type']; $type=$this->req['data']['type'];
......
...@@ -42,7 +42,7 @@ class ImageConst{ ...@@ -42,7 +42,7 @@ class ImageConst{
//商品、商家头像等默认图片路径 //商品、商家头像等默认图片路径
const defaultPath = 'mall/common/'; const defaultPath = 'mall/common/';
const storeClassAdvImagePrefix = 'mall/store/goods/classify'; const storeClassAdvImagePrefix = 'mall/store/goods/classify/';
const defaultMemberAvatarName = 'default_member_avatar.jpg'; const defaultMemberAvatarName = 'default_member_avatar.jpg';
......
...@@ -597,21 +597,29 @@ class CartServiceModel extends \Business\AbstractModel{ ...@@ -597,21 +597,29 @@ class CartServiceModel extends \Business\AbstractModel{
$deliverySetting['buyerDistribution'] = $store['buyer_distribution']; $deliverySetting['buyerDistribution'] = $store['buyer_distribution'];
$deliverySetting['sellerDistribution'] = $store['seller_distribution']; $deliverySetting['sellerDistribution'] = $store['seller_distribution'];
if($deliverySetting['sellerDistribution']&&$address){ if($deliverySetting['sellerDistribution']&&$address){
$str = str_replace('\"','"',$store['store_sales_scope']); if((isset($store['start_shipping_price'])&&$store['start_shipping_price']>\Our\ApiConst::zero)&&$storeCarts['storeTotalPrice']<$store['start_shipping_price']){
$store_sales_scope = json_decode($str,true); $deliverySetting['sellerDistribution'] = \Our\ApiConst::zero;
$result = \Our\CommonExtension::isPointInPolygon($store_sales_scope, array('lng'=>$address['lng'],'lat'=>$address['lat'])); }else{
$storeDistance = \Our\CommonExtension::getDistance($address['lat'],$address['lng'],$store['store_latitude'],$store['store_longitude'],\Our\ApiConst::one); $deliveryFreeFlag = $storeCarts['deliveryFreeFlag'];
if((isset($store['free_shipping_price'])&&$store['free_shipping_price']>\Our\ApiConst::zero)&&$storeCarts['storeTotalPrice']>=$store['free_shipping_price']){
if($result){ $deliveryFreeFlag = \Our\ApiConst::one;
$deliverTimeList = $deliveryFormulaDao->getDeliveryFormulaForCart($store,$storeDistance,$storeCarts['deliveryFreeFlag']); }
if($deliverTimeList){ $str = str_replace('\"','"',$store['store_sales_scope']);
$deliverySetting['deliverTimeList'] =$deliverTimeList; $store_sales_scope = json_decode($str,true);
$storeCartData['cartList'][$storeId]['storeDistance'] = $storeDistance; $result = \Our\CommonExtension::isPointInPolygon($store_sales_scope, array('lng'=>$address['lng'],'lat'=>$address['lat']));
$storeDistance = \Our\CommonExtension::getDistance($address['lat'],$address['lng'],$store['store_latitude'],$store['store_longitude'],\Our\ApiConst::one);
if($result){
$deliverTimeList = $deliveryFormulaDao->getDeliveryFormulaForCart($store,$storeDistance,$deliveryFreeFlag);
if($deliverTimeList){
$deliverySetting['deliverTimeList'] =$deliverTimeList;
$storeCartData['cartList'][$storeId]['storeDistance'] = $storeDistance;
}else{
$deliverySetting['sellerDistribution'] = \Our\ApiConst::zero;
}
}else{ }else{
$deliverySetting['sellerDistribution'] = \Our\ApiConst::zero; $deliverySetting['sellerDistribution'] = \Our\ApiConst::zero;
} }
}else{
$deliverySetting['sellerDistribution'] = \Our\ApiConst::zero;
} }
}else{ }else{
$deliverySetting['sellerDistribution'] = \Our\ApiConst::zero; $deliverySetting['sellerDistribution'] = \Our\ApiConst::zero;
...@@ -975,8 +983,6 @@ class CartServiceModel extends \Business\AbstractModel{ ...@@ -975,8 +983,6 @@ class CartServiceModel extends \Business\AbstractModel{
//删除订单列表缓存 //删除订单列表缓存
$orderDao=\DAO\Order\OrderModel::getInstance(); $orderDao=\DAO\Order\OrderModel::getInstance();
$orderDao->deleteOrderCache($memberId); $orderDao->deleteOrderCache($memberId);
$memberDao=\DAO\MemberModel::getInstance(DbNameConst::masterDBConnectName);
$memberDao->changeNum($memberId,ApiConst::orderStateWaitConfirm,null,ApiConst::one);
return $return; return $return;
} }
......
...@@ -315,12 +315,16 @@ class GoodsClassServiceModel extends \Business\AbstractModel{ ...@@ -315,12 +315,16 @@ class GoodsClassServiceModel extends \Business\AbstractModel{
$childrenClasses = array(); $childrenClasses = array();
if(isset($treeGcIds[$secondGcId][\Our\ApiConst::zero])&&$newPlatThirdGcList){ if(isset($treeGcIds[$secondGcId][\Our\ApiConst::zero])&&$newPlatThirdGcList){
foreach($treeGcIds[$secondGcId][\Our\ApiConst::zero] as $tempPaltThirdGcId){ foreach($treeGcIds[$secondGcId][\Our\ApiConst::zero] as $tempPaltThirdGcId){
$childrenClasses[] = $newPlatThirdGcList[$tempPaltThirdGcId]; $tempPlatClass = $newPlatThirdGcList[$tempPaltThirdGcId];
$tempPlatClass['storeFlag'] = \Our\ApiConst::zero;
$childrenClasses[] = $tempPlatClass;
} }
} }
if(isset($treeGcIds[$secondGcId][\Our\ApiConst::one])&&$storeThirdGcList){ if(isset($treeGcIds[$secondGcId][\Our\ApiConst::one])&&$storeThirdGcList){
foreach($treeGcIds[$secondGcId][\Our\ApiConst::one] as $tempStoreThirdGcId){ foreach($treeGcIds[$secondGcId][\Our\ApiConst::one] as $tempStoreThirdGcId){
$childrenClasses[] = $storeThirdGcList[$tempStoreThirdGcId]; $tempStoreClass = $storeThirdGcList[$tempStoreThirdGcId] ;
$tempStoreClass['storeFlag'] = \Our\ApiConst::one;
$childrenClasses[] = $tempStoreClass;
} }
} }
$returnTemp['childClasses'] = $childrenClasses; $returnTemp['childClasses'] = $childrenClasses;
......
...@@ -539,7 +539,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -539,7 +539,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$commonInstance = \DAO\GoodsCommonModel::getInstance(); $commonInstance = \DAO\GoodsCommonModel::getInstance();
$count = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonInstance, 'getCount'),array(array('store_id'=>$storeId)),\Our\ApiConst::oneDaySecond); $count = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonInstance, 'getCount'),array(array('store_id'=>$storeId)),\Our\ApiConst::oneDaySecond);
return array('storeId'=>$storeId,'storeName'=>$storeInfo['store_name'],'storeLabel'=>\DAO\StoreModel::getInstance()->getStoreLabelSrc($storeInfo['store_label'],\Our\ImageConst::goodsStoreImg),'goodsTotal'=>$count,'isQuality'=>$storeInfo['store_zhping'],'freeShippingPrice'=>$storeInfo['free_shipping_price']*100,'shareDesc'=>$storeInfo['store_share_desc'],'memberId'=>$storeInfo['member_id']); return array('storeId'=>$storeId,'storeName'=>$storeInfo['store_name'],'storeLabel'=>\DAO\StoreModel::getInstance()->getStoreLabelSrc($storeInfo['store_label'],\Our\ImageConst::goodsStoreImg),'goodsTotal'=>$count,'isQuality'=>$storeInfo['store_zhping'],'freeShippingPrice'=>$storeInfo['free_shipping_price'],'shareDesc'=>$storeInfo['store_share_desc'],'memberId'=>$storeInfo['member_id']);
} }
/** /**
......
...@@ -24,7 +24,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -24,7 +24,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
*/ */
public function getGroupGoods($param){ public function getGroupGoods($param){
$groupId = intval($param['groupId']); $groupId = intval($param['groupId']);
$groupList = $this->getPBundlingListByBlIds(array($groupId)); $groupList = $this->getPBundlingListByBlIds(array($groupId),\Our\DbNameConst::salveDBConnectName,array(),false,\Our\ApiConst::one);
if(!$groupList){ if(!$groupList){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyPBundlingdForOrder); \Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyPBundlingdForOrder);
} }
...@@ -32,6 +32,8 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -32,6 +32,8 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
$data['state'] = \Our\ApiConst::cartGoodsOnline; $data['state'] = \Our\ApiConst::cartGoodsOnline;
if($data['bl_state'] == \Our\ApiConst::zero) { if($data['bl_state'] == \Our\ApiConst::zero) {
$data['state'] = \Our\ApiConst::zero; $data['state'] = \Our\ApiConst::zero;
}else if(isset($data['is_del'])&&$data['is_del']==\Our\ApiConst::one){
$data['state'] = \Our\ApiConst::cartGoodsOffline;
}else if(!($data['bl_quota_starttime'] < time() && $data['endTime'] >= time())||!$data['goodsCountFlag']) { }else if(!($data['bl_quota_starttime'] < time() && $data['endTime'] >= time())||!$data['goodsCountFlag']) {
$data['state'] = \Our\ApiConst::cartGoodsOffline; $data['state'] = \Our\ApiConst::cartGoodsOffline;
}else if($data['bl_storage']<=\Our\ApiConst::zero) { }else if($data['bl_storage']<=\Our\ApiConst::zero) {
...@@ -251,7 +253,10 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -251,7 +253,10 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
$storeIds = $cartListData['storeIds']; $storeIds = $cartListData['storeIds'];
$newResult = array(); $newResult = array();
foreach($storeIds as $key){ foreach($storeIds as $key){
$newResult[] = $result[$key]; $tempReturnCart = $result[$key];
$tempStore = $storeDao->get($key,false);
$tempReturnCart['inAreaFlag'] = $storeDao->checkAddressInServiceArea($address,$tempStore);
$newResult[] = $tempReturnCart;
} }
return array('totalCount'=>count($storeCartList),'list'=>$newResult); return array('totalCount'=>count($storeCartList),'list'=>$newResult);
} }
...@@ -948,7 +953,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -948,7 +953,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
$tempObj['goodsAttr'] = $goodsDao->getFormatGoodsAttr($goods['goods_spec']); $tempObj['goodsAttr'] = $goodsDao->getFormatGoodsAttr($goods['goods_spec']);
} }
$store = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(),array(&$storeDao, 'getInfoById'),array($storeId,\Our\NameConst::allField,false,\Our\DbNameConst::salveDBConnectName),\Our\ApiConst::oneHour); $store = $storeDao->get($storeId,false);
$tempObj['goodsMid'] = $store['member_id']; $tempObj['goodsMid'] = $store['member_id'];
$storeCarts[] = $tempObj; $storeCarts[] = $tempObj;
$temp['goodsFreight'] = $goodsFreight; $temp['goodsFreight'] = $goodsFreight;
......
...@@ -88,7 +88,11 @@ class MessageServiceModel extends \Business\AbstractModel ...@@ -88,7 +88,11 @@ class MessageServiceModel extends \Business\AbstractModel
} }
public function getUnreadCountByMemberIdAndType($toId){
$messageHistoryDao=\DAO\MessageHistoryModel::getInstance();
$count=$messageHistoryDao->getUnreadCountByToIdAndToType($toId);
return $count;
}
/** /**
* 根据消息类型获得一条消息,已经未读消息数量 * 根据消息类型获得一条消息,已经未读消息数量
* *
...@@ -129,8 +133,9 @@ class MessageServiceModel extends \Business\AbstractModel ...@@ -129,8 +133,9 @@ class MessageServiceModel extends \Business\AbstractModel
} }
if ($type == 4) { if ($type == 4) {
$store = \DAO\StoreModel::getInstance(); $store = \DAO\StoreModel::getInstance();
$store->setDb($db); $storeData=\Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$store, 'getInfoById'), array($userid, $store->detailField), \Our\ApiConst::oneDaySecond);
$avatar = $store->getInfoById($userid, 'store_label', 'store_label'); $avatar=$storeData['storeLabel'];
// $avatar = $store->getInfoById($userid, 'store_label', 'store_label');
$avatar = Common::getStaticFile($avatar, ImageConst::storeLabel, ImageConst::imageDomain); $avatar = Common::getStaticFile($avatar, ImageConst::storeLabel, ImageConst::imageDomain);
} }
...@@ -246,17 +251,17 @@ class MessageServiceModel extends \Business\AbstractModel ...@@ -246,17 +251,17 @@ class MessageServiceModel extends \Business\AbstractModel
$memberHistory = $memageHistoryDao->getOneById($messageHistoryId); $memberHistory = $memageHistoryDao->getOneById($messageHistoryId);
$isSuccess = false; $isSuccess = false;
if ($memberHistory['fromId'] == $memberId) { if ($memberHistory['fromId'] == $memberId) {
if ($memberHistory['status'] == ApiConst::recieveRemove) { if ($memberHistory['isDel'] == ApiConst::recieveRemove) {
$isSuccess = $memageHistoryDao->update($messageHistoryId, 'status', ApiConst::remove); $isSuccess = $memageHistoryDao->update($messageHistoryId, 'isDel', ApiConst::remove);
} else { } else {
$isSuccess = $memageHistoryDao->update($messageHistoryId, 'status', ApiConst::sendRemove); $isSuccess = $memageHistoryDao->update($messageHistoryId, 'isDel', ApiConst::sendRemove);
} }
} }
if ($memberHistory['toId'] == $memberId) { if ($memberHistory['toId'] == $memberId) {
if ($memberHistory['status'] == ApiConst::sendRemove) { if ($memberHistory['isDel'] == ApiConst::sendRemove) {
$isSuccess = $memageHistoryDao->update($messageHistoryId, 'status', ApiConst::remove); $isSuccess = $memageHistoryDao->update($messageHistoryId, 'isDel', ApiConst::remove);
} else { } else {
$isSuccess = $memageHistoryDao->update($messageHistoryId, 'status', ApiConst::recieveRemove); $isSuccess = $memageHistoryDao->update($messageHistoryId, 'isDel', ApiConst::recieveRemove);
} }
} }
return $isSuccess; return $isSuccess;
......
...@@ -254,7 +254,9 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -254,7 +254,9 @@ class OrderServiceModel extends \Business\AbstractModel
$this->orderGoodsList = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderId, $this->getGoodsDetailField()), \Our\ApiConst::oneDaySecond, array($orderId)); $this->orderGoodsList = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderId, $this->getGoodsDetailField()), \Our\ApiConst::oneDaySecond, array($orderId));
//商店相关信息 //商店相关信息
$this->store = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$storeDao, 'getInfoById'), array($this->order['storeId'], $this->storeField), \Our\ApiConst::oneDaySecond); // $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']));
$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);
...@@ -277,7 +279,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -277,7 +279,7 @@ class OrderServiceModel extends \Business\AbstractModel
$returnData['diliverymanId'] = ApiConst::zero; $returnData['diliverymanId'] = ApiConst::zero;
$returnData['deliveryman'] = new \stdClass(); $returnData['deliveryman'] = new \stdClass();
} }
$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'] : '';
$returnData['reciverInfo'] = $this->address; $returnData['reciverInfo'] = $this->address;
...@@ -830,8 +832,9 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -830,8 +832,9 @@ 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'], $this->storeField), \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); $orderGoods = $goodsDao->convert($this->orderGoodsList);
if (empty($orderGoods)) { if (empty($orderGoods)) {
......
...@@ -217,6 +217,7 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -217,6 +217,7 @@ class RefundServiceModel extends \Business\AbstractModel
//退款原因列表 //退款原因列表
$refundReasonDao = \DAO\Order\RefundReasonModel::getInstance(); $refundReasonDao = \DAO\Order\RefundReasonModel::getInstance();
$storeDao = \DAO\StoreModel::getInstance(); $storeDao = \DAO\StoreModel::getInstance();
$refundReasonList = \Our\RedisHelper::cachedFunction(\Redis\Db5\RefundReasonRedisModel::getInstance(), array(&$refundReasonDao, 'getAll'), array($this->refunReasonField), \Our\ApiConst::oneDaySecond); $refundReasonList = \Our\RedisHelper::cachedFunction(\Redis\Db5\RefundReasonRedisModel::getInstance(), array(&$refundReasonDao, 'getAll'), array($this->refunReasonField), \Our\ApiConst::oneDaySecond);
$shippingTypes = array_values(ArrayConst::refundShippingType); $shippingTypes = array_values(ArrayConst::refundShippingType);
$refundTypes = array_values(ArrayConst::refundTypes); $refundTypes = array_values(ArrayConst::refundTypes);
...@@ -228,11 +229,15 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -228,11 +229,15 @@ class RefundServiceModel extends \Business\AbstractModel
if (empty($orderInfo)) { if (empty($orderInfo)) {
ErrorModel::throwException(CodeConfigModel::notExistRefund); ErrorModel::throwException(CodeConfigModel::notExistRefund);
} }
//获得订单商品 //获得订单商品
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(); $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance();
$orderGoodses = \Our\RedisHelper::cachedFunction(\Redis\Db5\RefundReasonRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderInfo['orderId'], $this->orderGoodsField), \Our\ApiConst::oneDaySecond); $orderGoodses = \Our\RedisHelper::cachedFunction(\Redis\Db5\RefundReasonRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderInfo['orderId'], $this->orderGoodsField), \Our\ApiConst::oneDaySecond);
$orderGoodses = $orderGoodsDao->convertOrderGoods($orderGoodses, 'goodsId'); $orderGoodses = $orderGoodsDao->convertOrderGoods($orderGoodses, 'goodsId');
$goodsIds = $orderGoodsDao->getRefundOrderGoodsIds($orderGoodses); $goodsIds = $orderGoodsDao->getRefundOrderGoodsIds($orderGoodses);
// $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($orderInfo['storeId'], $storeDao->detailField), \Our\ApiConst::sevenDaySecond,array($orderInfo['storeId']));
if(!empty($orderGoodses[$goodsId])){ if(!empty($orderGoodses[$goodsId])){
$orderGoods = $orderGoodses[$goodsId]; $orderGoods = $orderGoodses[$goodsId];
} }
...@@ -261,6 +266,7 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -261,6 +266,7 @@ class RefundServiceModel extends \Business\AbstractModel
'storeName'=>$orderInfo['storeName'], 'storeName'=>$orderInfo['storeName'],
'storeId'=>$orderInfo['storeId'], 'storeId'=>$orderInfo['storeId'],
'refundSeletedId'=>$orderDao->selectedTypeId($orderInfo), 'refundSeletedId'=>$orderDao->selectedTypeId($orderInfo),
'storeMemberId'=>$this->store['memberId']
); );
$refundCondition = $orderInfo['refundCondition'] ? unserialize($orderInfo['refundCondition']) : array(); $refundCondition = $orderInfo['refundCondition'] ? unserialize($orderInfo['refundCondition']) : array();
$returnData['needShippingFee'] = $orderInfo['needShippingFee']; $returnData['needShippingFee'] = $orderInfo['needShippingFee'];
...@@ -430,6 +436,7 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -430,6 +436,7 @@ class RefundServiceModel extends \Business\AbstractModel
{ {
$refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(); $refundReturnDao = \DAO\Order\RefundReturnModel::getInstance();
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(); $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance();
$storeDao = \DAO\StoreModel::getInstance(DbNameConst::salveDBConnectName);
$goodsDao = \DAO\GoodsModel::getInstance(); $goodsDao = \DAO\GoodsModel::getInstance();
$refundReturn = $refundReturnDao->findByRefundId($returnId, $this->refundReturnField); $refundReturn = $refundReturnDao->findByRefundId($returnId, $this->refundReturnField);
$diliveryManDao=\DAO\Order\DiliverymanModel::getInstance(DbNameConst::salveDBConnectName); $diliveryManDao=\DAO\Order\DiliverymanModel::getInstance(DbNameConst::salveDBConnectName);
...@@ -437,6 +444,10 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -437,6 +444,10 @@ class RefundServiceModel extends \Business\AbstractModel
ErrorModel::throwException(CodeConfigModel::notExistRefund); ErrorModel::throwException(CodeConfigModel::notExistRefund);
} }
$orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db5\RefundReasonRedisModel::getInstance(), array(&$orderGoodsDao, 'findByRecId'), array($refundReturn['orderGoodsId'], $this->getGoodsDetailField()), \Our\ApiConst::oneDaySecond); $orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db5\RefundReasonRedisModel::getInstance(), array(&$orderGoodsDao, 'findByRecId'), array($refundReturn['orderGoodsId'], $this->getGoodsDetailField()), \Our\ApiConst::oneDaySecond);
// $this->store=$storeDao->get($refundReturn['storeId']);
// $this->store=Common::convertUnderline($this->store[0]);
$this->store = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$storeDao, 'getInfoById'), array($refundReturn['storeId'],$storeDao->detailField), \Our\ApiConst::sevenDaySecond,array($refundReturn['storeId']));
$refundReturn['goodsGroup'] = $goodsDao->getGoodsGroup($orderGoods['goodsGroup']); $refundReturn['goodsGroup'] = $goodsDao->getGoodsGroup($orderGoods['goodsGroup']);
$refundReturn['goodsAttr'] = $goodsDao->getFormatGoodsAttr($orderGoods['goodsSpec']); $refundReturn['goodsAttr'] = $goodsDao->getFormatGoodsAttr($orderGoods['goodsSpec']);
$refundReturn['sellerStateName'] = ArrayConst::sellerState[$refundReturn['sellerState']]; $refundReturn['sellerStateName'] = ArrayConst::sellerState[$refundReturn['sellerState']];
...@@ -447,8 +458,9 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -447,8 +458,9 @@ class RefundServiceModel extends \Business\AbstractModel
$refundReturn['picInfo'] = $refundReturnDao->getRefundPics($refundReturn['picInfo']['buyer']); $refundReturn['picInfo'] = $refundReturnDao->getRefundPics($refundReturn['picInfo']['buyer']);
} }
//平台操作类型 //平台操作类型
$refundReturn['storeMemberId']=$this->store['memberId'];
$refundReturn['platformStateName'] = ArrayConst::platformState[$refundReturn['platformState']]; $refundReturn['platformStateName'] = ArrayConst::platformState[$refundReturn['platformState']];
$refundReturn['refundShippingTypeName'] = ArrayConst::refundShippingType[$refundReturn['refundShippingType']]['name']; $refundReturn['refundShippingTypeName'] = ArrayConst::refundShippingType[$refundReturn['refundShippingType']]['name'];
$refundReturn['refundText'] = $refundReturnDao->getRefundTextStatus($refundReturn); $refundReturn['refundText'] = $refundReturnDao->getRefundTextStatus($refundReturn);
$refundReturn['goodsImage'] = ImageUtil::getGoodsImgUrl($refundReturn['goodsImage'], ApiConst::goodsSmallSize); $refundReturn['goodsImage'] = ImageUtil::getGoodsImgUrl($refundReturn['goodsImage'], ApiConst::goodsSmallSize);
$addressDao = \DAO\Order\DAddressModel::getInstance(); $addressDao = \DAO\Order\DAddressModel::getInstance();
......
...@@ -123,7 +123,7 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -123,7 +123,7 @@ class StoreServiceModel extends \Business\AbstractModel{
$favType = 1; $favType = 1;
} }
} }
return array('storeLabel'=>$storeLabel,'storeName'=>$storeInfo['store_name'],'grade'=>$grade,'fansCount'=>\DAO\FavoritesStoreModel::getInstance()->getFavoritesStoreCountByStoreId($storeId),'favType'=>$favType,'monthlySalesCount'=>$monthlySalesCount,'defaultDeliveryTime'=>$defaultDeliveryTime,'freeShippingPrice'=>$storeInfo['free_shipping_price'] * 100,'storeDistance'=>$distince,'storeNotice'=>$storeInfo['store_notice'],'startShippingPrice'=>$storeInfo['start_shipping_price'] * 100,'memberId'=>$storeInfo['member_id'],'inStoreService'=>$in_store_service_flag,'adv'=>$adv,'memberId'=>$storeInfo['member_id']); return array('storeLabel'=>$storeLabel,'storeName'=>$storeInfo['store_name'],'grade'=>$grade,'fansCount'=>\DAO\FavoritesStoreModel::getInstance()->getFavoritesStoreCountByStoreId($storeId),'favType'=>$favType,'monthlySalesCount'=>$monthlySalesCount,'defaultDeliveryTime'=>$defaultDeliveryTime,'freeShippingPrice'=>$storeInfo['free_shipping_price'],'storeDistance'=>$distince,'storeNotice'=>$storeInfo['store_notice'],'startShippingPrice'=>$storeInfo['start_shipping_price'],'memberId'=>$storeInfo['member_id'],'inStoreService'=>$in_store_service_flag,'adv'=>$adv,'memberId'=>$storeInfo['member_id']);
} }
/** /**
......
...@@ -366,7 +366,7 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -366,7 +366,7 @@ class CouponModel extends \DAO\AbstractModel {
$totalPrice = \Our\ApiConst::zero; $totalPrice = \Our\ApiConst::zero;
if($gcTotalPriceArray){ if($gcTotalPriceArray){
foreach($gcTotalPriceArray as $key=>$gcTotalPrice){ foreach($gcTotalPriceArray as $key=>$gcTotalPrice){
if(strpos($coupon['ids'],','.$key.',')===\Our\ApiConst::zero||strpos($coupon['ids'],','.$key.',')>\Our\ApiConst::zero){ if(strpos($coupon['ids'],','.$key.',')!==false){
$totalPrice +=$gcTotalPrice['totalPrice']; $totalPrice +=$gcTotalPrice['totalPrice'];
} }
} }
...@@ -419,11 +419,12 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -419,11 +419,12 @@ class CouponModel extends \DAO\AbstractModel {
$gcPrices = array(); $gcPrices = array();
$goodsCommonPrices = array(); $goodsCommonPrices = array();
foreach($goodsList as $goods){ foreach($goodsList as $goods){
$goodsNum = $goods['goodsNum'];
if($goods['type']== \Our\ApiConst::addGoodsToCart){ if($goods['type']== \Our\ApiConst::addGoodsToCart){
if(strpos($giftGoodsIds,','.$goods['goodsId'].',')===\Our\ApiConst::zero||strpos($giftGoodsIds,','.$goods['goodsId'].',')>\Our\ApiConst::zero){
$goodsNum = $goods['goodsNum'];
if(strpos($giftGoodsIds,','.$goods['goodsCommonId'].',')!==false){
$giftGoodsAmount += $goods['goodsPrice']; $giftGoodsAmount += $goods['goodsPrice'];
$goodsNum = $goods['goodsNum']-\Our\ApiConst::one; $goodsNum = $goodsNum-\Our\ApiConst::one;
} }
if($goodsNum>\Our\ApiConst::zero){ if($goodsNum>\Our\ApiConst::zero){
if(isset($gcPrices[$goods['gcId']])){ if(isset($gcPrices[$goods['gcId']])){
...@@ -449,7 +450,7 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -449,7 +450,7 @@ class CouponModel extends \DAO\AbstractModel {
return false; return false;
} }
foreach($gcPrices as $key=>$gcTotalPrice){ foreach($gcPrices as $key=>$gcTotalPrice){
if(strpos($coupon['ids'],','.$key.',')===\Our\ApiConst::zero||strpos($coupon['ids'],','.$key.',')>\Our\ApiConst::zero){ if(strpos($coupon['ids'],','.$key.',')!==false){
$totalPrice +=$gcTotalPrice; $totalPrice +=$gcTotalPrice;
} }
} }
...@@ -458,12 +459,12 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -458,12 +459,12 @@ class CouponModel extends \DAO\AbstractModel {
return false; return false;
} }
foreach($goodsCommonPrices as $key=>$goodsCommonPrice){ foreach($goodsCommonPrices as $key=>$goodsCommonPrice){
if(strpos($coupon['ids'],','.$key.',')===\Our\ApiConst::zero||strpos($coupon['ids'],','.$key.',')>\Our\ApiConst::zero){ if(strpos($coupon['ids'],','.$key.',')!==false){
$totalPrice += $goodsCommonPrice; $totalPrice += $goodsCommonPrice;
} }
} }
}else if($coupon['type'] == \Our\ApiConst::commonCoupon){//普通优惠券 }else if($coupon['type'] == \Our\ApiConst::commonCoupon){//普通优惠券
if($storeCouponPrice>\Our\ApiConst::zero){ if($storeCouponPrice==\Our\ApiConst::zero){
return false; return false;
} }
$totalPrice += $storeCouponPrice; $totalPrice += $storeCouponPrice;
......
...@@ -34,7 +34,7 @@ class GoodsClassThirdModel extends \DAO\AbstractModel{ ...@@ -34,7 +34,7 @@ class GoodsClassThirdModel extends \DAO\AbstractModel{
public function getListByIdsFromCache($ids){ public function getListByIdsFromCache($ids){
$field = $this->thirdStoreClassField; $field = $this->thirdStoreClassField;
$returnList = \Our\RedisHelper::cachedFunction(\Redis\Db3\GoodsClassThirdModelRedisModel::getInstance(),array(&$this, 'getListByIds'),array($ids,$field),\Our\ApiConst::oneDaySecond); $returnList = \Our\RedisHelper::cachedFunction(\Redis\Db3\GoodsClassThirdRedisModel::getInstance(),array(&$this, 'getListByIds'),array($ids,$field),\Our\ApiConst::oneDaySecond);
return $returnList; return $returnList;
} }
...@@ -51,7 +51,7 @@ class GoodsClassThirdModel extends \DAO\AbstractModel{ ...@@ -51,7 +51,7 @@ class GoodsClassThirdModel extends \DAO\AbstractModel{
$whereSql = $this->db->getSqlWhereByArray($where); $whereSql = $this->db->getSqlWhereByArray($where);
$this->db->select($field)->from($this->_tableName)->where($whereSql); $this->db->select($field)->from($this->_tableName)->where($whereSql);
foreach($order as $key=>$val){ foreach($order as $key=>$val){
$this->db->order($val,$key); $this->db->order($key,$val);
} }
$list =$this->db->fetchAll(); $list =$this->db->fetchAll();
$returnList = array(); $returnList = array();
......
...@@ -108,6 +108,7 @@ class MemberModel extends \DAO\AbstractModel ...@@ -108,6 +108,7 @@ class MemberModel extends \DAO\AbstractModel
} }
public function saveWxUserToken($key,$memberId){ public function saveWxUserToken($key,$memberId){
$member = $this->getInfo($memberId);
$memberDb0Redis = \Redis\Db0\MemberRedisModel::getInstance(); $memberDb0Redis = \Redis\Db0\MemberRedisModel::getInstance();
$memberDb0Redis->tableHMSet($memberId, array('wxUserToken'=>$key)); $memberDb0Redis->tableHMSet($memberId, array('wxUserToken'=>$key));
} }
...@@ -536,7 +537,6 @@ class MemberModel extends \DAO\AbstractModel ...@@ -536,7 +537,6 @@ class MemberModel extends \DAO\AbstractModel
case ApiConst::orderStateWaitPay: case ApiConst::orderStateWaitPay:
$type = NameConst::waitPay; $type = NameConst::waitPay;
break; break;
case ApiConst::orderStateWaitConfirm:
case ApiConst::orderStateWaitSend: case ApiConst::orderStateWaitSend:
$type = NameConst::waitShipments; $type = NameConst::waitShipments;
break; break;
......
...@@ -38,12 +38,19 @@ class MessageHistoryModel extends \DAO\AbstractModel { ...@@ -38,12 +38,19 @@ class MessageHistoryModel extends \DAO\AbstractModel {
* *
*/ */
public function getListByMemberIdAndToIdAndToType($memberId,$selfType,$toId,$toType,$field='*',$pageIndex=0,$pageSize=20){ public function getListByMemberIdAndToIdAndToType($memberId,$selfType,$toId,$toType,$field='*',$pageIndex=0,$pageSize=20){
$where=Common::format(" ((fromId={0} and toId={1} and toType={2} and fromType={3} and status<>2) or (fromId={4} and toId={5} and fromType={6} and toType={7} and status<>3)) and status<>-1",$memberId,$toId,$toType,$selfType,$toId,$memberId,$toType,$selfType); $where=Common::format(" ((fromId={0} and toId={1} and toType={2} and fromType={3} and isDel not in(-1,2)) or (fromId={4} and toId={5} and fromType={6} and toType={7} and isDel not in(-1,3)))",$memberId,$toId,$toType,$selfType,$toId,$memberId,$toType,$selfType);
parent::setDb(); parent::setDb();
$messages=$this->lists($where,array('gmtCreate'=>'desc'),$field,$pageIndex,$pageSize); $messages=$this->lists($where,array('gmtCreate'=>'desc'),$field,$pageIndex,$pageSize);
return $messages; return $messages;
} }
public function getUnreadCountByToIdAndToType($toId,$toType){
$this->setDb($this->dbName);
$where=Common::format(" (toId={0} and status ={2})",$toId,$toType,ApiConst::unread);
$num=$this->db->from($this->_tableName)->select("count(*) as count")->where($where)->fetchNum();
return $num?$num:ApiConst::zero;
}
public function getOneById($id,$field='*'){ public function getOneById($id,$field='*'){
parent::setDb(); parent::setDb();
$where[$this->_primaryKey]=$id; $where[$this->_primaryKey]=$id;
...@@ -65,7 +72,7 @@ class MessageHistoryModel extends \DAO\AbstractModel { ...@@ -65,7 +72,7 @@ class MessageHistoryModel extends \DAO\AbstractModel {
} }
public function updateByFromIdAndSelfTypeAndToIdAndToType($fromId,$fromType,$toId,$toType){ public function updateByFromIdAndSelfTypeAndToIdAndToType($fromId,$fromType,$toId,$toType){
$where=Common::format(" (((fromId={0} and toId={1} and toType={2} and fromType={3}) or (toId={2} and fromId={3} and fromType={0} and toType={1})) and status=0)",$toId,$fromId,$fromType,$toType); $where=Common::format(" (((fromId={0} and toId={1} and toType={2} and fromType={3}) and status=0))",$toId,$fromId,$fromType,$toType);
$data['status']=ApiConst::read; $data['status']=ApiConst::read;
return $this->updateByWhere($where,$data); return $this->updateByWhere($where,$data);
} }
......
...@@ -846,6 +846,7 @@ class OrderModel extends \DAO\AbstractModel ...@@ -846,6 +846,7 @@ class OrderModel extends \DAO\AbstractModel
$favoritesStoreDao->deleteGetFavoritesCountByStoreId($stroeId); $favoritesStoreDao->deleteGetFavoritesCountByStoreId($stroeId);
} }
$this->deleteGetListByMemberId($stroeId);
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName); $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName);
$orderGoodsDao->deleteOrderGoodsCache($memberId, $orderId,$stroeId); $orderGoodsDao->deleteOrderGoodsCache($memberId, $orderId,$stroeId);
} }
......
...@@ -238,7 +238,7 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -238,7 +238,7 @@ class OrderGoodsModel extends \DAO\AbstractModel {
public function getMemberStoreStaticsByCreateTime($gmtCreate,$pageIndex,$pageSize){ public function getMemberStoreStaticsByCreateTime($gmtCreate,$pageIndex,$pageSize){
$this->setDb($this->dbName); $this->setDb($this->dbName);
$where =\Our\Common::format(' gmt_update>={0} and gmt_update<{1} ',$gmtCreate,TIMESTAMP); $where =\Our\Common::format(' gmt_update>={0} and gmt_update<{1} ',$gmtCreate,TIMESTAMP);
$res=$this->lists($where,array('gmt_create'=>'asc'),$this->sumField,$pageIndex,$pageSize); $res=$this->lists($where,array('gmt_update'=>'asc'),$this->sumField,$pageIndex,$pageSize);
return $res['list']?$res:false; return $res['list']?$res:false;
} }
public function getMemberStoreOrderGoodsCount($storeIds,$memberIds){ public function getMemberStoreOrderGoodsCount($storeIds,$memberIds){
......
...@@ -13,6 +13,7 @@ use Our\ImageConst; ...@@ -13,6 +13,7 @@ use Our\ImageConst;
class StoreModel extends \DAO\AbstractModel class StoreModel extends \DAO\AbstractModel
{ {
public $detailField= " member_id as memberId,store_id as storeId,offline_payway as offlinePayway,store_label as storeLabel";
protected function init() protected function init()
{ {
......
...@@ -6,7 +6,7 @@ namespace Redis\Db3; ...@@ -6,7 +6,7 @@ namespace Redis\Db3;
* Time: 17:54 * Time: 17:54
* Description: * Description:
*/ */
class GoodsClassThirdModelRedisModel extends \Redis\Db3\AbstractModel{ class GoodsClassThirdRedisModel extends \Redis\Db3\AbstractModel{
/** /**
* 表名 * 表名
* *
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>获得已发送消息的用户列表和(系统消息,订单消息,快递用户消息最后一条消息)</title>
<style>
</style>
</head>
<body>
<form action="/message/getUnreadCount" method="post">
用户登录状态key:<input name="data[key]" value="fd4b739c4815297044191451eabf0eb5"/><br />
<input type="submit" value="提交">
</form>
</body>
</html>
\ No newline at end of file
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
用户登录状态key:<input name="data[key]" value="ceb72deab920ac0edb7272b2ed9dfa1e"/><br /> 用户登录状态key:<input name="data[key]" value="ceb72deab920ac0edb7272b2ed9dfa1e"/><br />
订单状态id:<input name="data[orderState]" value=""/><br /> 订单状态id:<input name="data[orderState]" value=""/><br />
订单号:<input name="data[keyword]" value="400"/><br /> keyword:<input name="data[keyword]" value="400"/><br />
<p id="img_area"></p> <p id="img_area"></p>
<input type="submit" value="提交"> <input type="submit" value="提交">
</form> </form>
......
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