Commit da65973d authored by zhz's avatar zhz

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

parents 791a90fe f1669566
...@@ -138,6 +138,7 @@ class CartController extends \Our\Controller_AbstractApi{ ...@@ -138,6 +138,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;
......
...@@ -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;
......
...@@ -950,7 +950,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -950,7 +950,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;
}
/** /**
* 根据消息类型获得一条消息,已经未读消息数量 * 根据消息类型获得一条消息,已经未读消息数量
* *
...@@ -238,17 +242,17 @@ class MessageServiceModel extends \Business\AbstractModel ...@@ -238,17 +242,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'], $this->storeField), \Our\ApiConst::oneDaySecond,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;
......
...@@ -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,14 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -228,11 +229,14 @@ 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]);
if(!empty($orderGoodses[$goodsId])){ if(!empty($orderGoodses[$goodsId])){
$orderGoods = $orderGoodses[$goodsId]; $orderGoods = $orderGoodses[$goodsId];
} }
...@@ -261,6 +265,7 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -261,6 +265,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 +435,7 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -430,6 +435,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 +443,8 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -437,6 +443,8 @@ 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]);
$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 +455,9 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -447,8 +455,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();
......
...@@ -46,29 +46,29 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -46,29 +46,29 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
//获得统计数据 //获得统计数据
public function getStatistics($memberId) public function getStatistics($memberId)
{ {
$memberDao=\DAO\MemberModel::getInstance(); $memberDao = \DAO\MemberModel::getInstance();
$storeId=$memberDao->getInfo($memberId,'store_id'); $storeId = $memberDao->getInfo($memberId, 'store_id');
//$storeId = $this->_getStoreByMemberId($memberId); //$storeId = $this->_getStoreByMemberId($memberId);
// $storeStatisticsDayDao = \DAO\Store\StoreStatisticsDayModel::getInstance(); // $storeStatisticsDayDao = \DAO\Store\StoreStatisticsDayModel::getInstance();
// $storeStatisticsDao = \DAO\StoreStatisticsModel::getInstance(); // $storeStatisticsDao = \DAO\StoreStatisticsModel::getInstance();
$orderDao=\DAO\Order\OrderModel::getInstance(); $orderDao = \DAO\Order\OrderModel::getInstance();
$favoritesStoreDao=\DAO\FavoritesStoreModel::getInstance(); $favoritesStoreDao = \DAO\FavoritesStoreModel::getInstance();
$orderGoodsDao=\DAO\Order\OrderGoodsModel::getInstance(); $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance();
$goodsCount=\Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsCountByStoreId'), array($storeId), ApiConst::tenDaySecond, array($storeId)); $goodsCount = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsCountByStoreId'), array($storeId), ApiConst::tenDaySecond, array($storeId));
$condition['store_id'] = $storeId; $condition['store_id'] = $storeId;
//获取店铺信息 //获取店铺信息
$store = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this->storeDao, 'getInfo'), array($condition), ApiConst::tenDaySecond, array($storeId)); $store = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this->storeDao, 'getInfo'), array($condition), ApiConst::tenDaySecond, array($storeId));
//获取店铺数据统计 //获取店铺数据统计
//$storeStats = $storeStatisticsDao->find($condition); //$storeStats = $storeStatisticsDao->find($condition);
//获取店铺今日销售额和订单量 //获取店铺今日销售额和订单量
// $storeStats=$orderDao->getShopKeeperCountByStoreId($storeId); // $storeStats=$orderDao->getShopKeeperCountByStoreId($storeId);
$storeStats = $orderDao->getShopKeeperCountByStoreIdCache($storeId); $storeStats = $orderDao->getShopKeeperCountByStoreIdCache($storeId);
$storeFavariteCount=$favoritesStoreDao->getFavoritesCountByStoreIdCache($storeId); $storeFavariteCount = $favoritesStoreDao->getFavoritesCountByStoreIdCache($storeId);
$data['storeId'] = $store['store_id']; $data['storeId'] = $store['store_id'];
$data['storeName'] = $store['store_name']; $data['storeName'] = $store['store_name'];
$data['storeLabel'] = $store['store_label']; $data['storeLabel'] = $store['store_label'];
$data['goodsCount'] = $goodsCount; $data['goodsCount'] = $goodsCount;
$data['orderCount'] =$storeStats['orderCount']; $data['orderCount'] = $storeStats['orderCount'];
$data['orderTotal'] = $storeStats['orderTotal']; $data['orderTotal'] = $storeStats['orderTotal'];
$data['favCount'] = $storeFavariteCount['favCount']; $data['favCount'] = $storeFavariteCount['favCount'];
$data['todayOrderCount'] = $storeStats['todayOrderCount']; $data['todayOrderCount'] = $storeStats['todayOrderCount'];
...@@ -241,8 +241,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -241,8 +241,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
} else { } else {
$update_data['order_state'] = ApiConst::orderStateWaitSend; $update_data['order_state'] = ApiConst::orderStateWaitSend;
$result = $orderDao->update($where, $update_data); $result = $orderDao->update($where, $update_data);
$orderDao->deleteOrderCache($order['buyer_id'], $orderId,$order['store_id'],true); $orderDao->deleteOrderCache($order['buyer_id'], $orderId, $order['store_id'], true);
// \Our\RedisHelper::memberTotalFromStateToState($order['buyer_id'], $order['order_state'], ApiConst::orderStateWaitSend); // \Our\RedisHelper::memberTotalFromStateToState($order['buyer_id'], $order['order_state'], ApiConst::orderStateWaitSend);
return $result; return $result;
} }
} }
...@@ -260,18 +260,25 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -260,18 +260,25 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
return $data; return $data;
} }
public function getRetrunDatas($where, $pageIndex, $pageSize) public function getRetrunDatas($storeId,$where, $pageIndex, $pageSize)
{ {
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(); $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance();
$orderDao = \DAO\Order\OrderModel::getInstance(); $orderDao = \DAO\Order\OrderModel::getInstance();
$goodsDao = \DAO\GoodsModel::getInstance(); $goodsDao = \DAO\GoodsModel::getInstance();
$returnData = $orderDao->getOrders($where,$this->orderListField,$pageIndex,$pageSize); $orderCommonDao=\DAO\Order\OrderCommonModel::getInstance();
$orders = $returnData['orders'];
$returnData = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderDao, 'getList'), array($where, $orderDao->getOrderDetailField(), $pageIndex, $pageSize, $order = array('gmt_update' => 'desc')), \Our\ApiConst::oneDaySecond, array($storeId));
//$returnData = $orderDao->getOrders($where, $this->orderListField, $pageIndex, $pageSize);
$orders = $returnData['list'];
if (!empty($orders)) { if (!empty($orders)) {
$orderIds = array_column($orders, 'orderId'); $orderIds = array_column($orders, 'orderId');
if (!empty($orderIds)) { if (!empty($orderIds)) {
$orderGoods = $orderGoodsDao->getOrderGoodsByOrderIds($orderIds, $orderGoodsDao->orderGoodsField);
$orderMerge = \Our\Common::intergrateOneToMany($orders, $orderGoods, 'orderId', 'orderId', 'orderGoods'); $orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderIds, $orderGoodsDao->orderGoodsField), \Our\ApiConst::oneDaySecond, array($storeId));
//$orderGoods = $orderGoodsDao->getOrderGoodsByOrderIds($orderIds, $orderGoodsDao->orderGoodsField);
$orderCommons=$orderCommonDao->getAllByOrderIds($orderIds,$orderCommonDao->orderCommonField);
$ordersOrderCommons=Common::intergrateOneToOne($orders,$orderCommons,'orderId','orderId');
$orderMerge = \Our\Common::intergrateOneToMany($ordersOrderCommons, $orderGoods, 'orderId', 'orderId', 'orderGoods');
foreach ($orderMerge as &$value) { foreach ($orderMerge as &$value) {
$value['orderStateName'] = $orderDao->getStatusText($value); $value['orderStateName'] = $orderDao->getStatusText($value);
$value['orderText'] = $orderDao->getText($value, ApiConst::orderListDescribe); $value['orderText'] = $orderDao->getText($value, ApiConst::orderListDescribe);
...@@ -286,60 +293,69 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -286,60 +293,69 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
} else { } else {
$value['orderGoods'] = array(); $value['orderGoods'] = array();
} }
unset($value['couponId']);
unset($value['refundAmount']);
unset($value['paymentTime']);
unset($value['finnshedTime']);
unset($value['paymentCode']);
unset($value['needShippingFee']);
unset($value['refundCondition']);
unset($value['delayTime']);
unset($value['reciverName']);
unset($value['reciverInfo']);
unset($value['daddressId']);
} }
$returnData['orders'] = $orderMerge; $return['orders'] = $orderMerge;
$returnData['totalCount'] = $returnData['totalCount']; $return['totalCount'] = $returnData['totalCount'];
} else { } else {
$returnData = new \stdClass(); $return = new \stdClass();
} }
} else { } else {
$returnData = new \stdClass(); $return = new \stdClass();
} }
return $returnData; return $return;
}
public function getOrderIndexWhere($storeId, $keyword, $pageIndex, $pageSize)
{
$query1[] = array('match' => array('storeId' => $storeId));
$res1['must'][0] = $query1;
$query2[] = array('match' => array('goodsName' => $keyword));
$query2[] = array('wildcard' => array('orderSn' => "*{$keyword}*"));
$res1['must'][1]['bool']['should'] = $query2;
$allQuery['bool'] = $res1;
$elasticTool = \Elastics\ElasticsToolModel::getInstance(NameConst::ordersIndex);
$res = $elasticTool->searchMatch($allQuery, $pageIndex, $pageSize);
$orderIdsField = array_column($res['list'], 'orderId');
$orderIds = implode(',', $orderIdsField);
if ($orderIds) {
$where = Common::format(" order_id in({0})", $orderIds);
}else{
$where=false;
}
return $where;
} }
public function getOrders($memberId, $pageIndex, $pageSize, $orderState, $keyword) public function getOrders($memberId, $pageIndex, $pageSize, $orderState, $keyword)
{ {
$storeId = $this->_getStoreByMemberId($memberId); $storeId = $this->_getStoreByMemberId($memberId);
// 'query' => array('bool'=>array('should' => $where)), if(empty($storeId)){
$allQuery=array(); ErrorModel::throwException(CodeConfigModel::paramsError);
$allQuery['bool']=array(); }
if(!empty($keyword)){ $allQuery = array();
$query1[]= array('match' => array('storeId' => $storeId)); $allQuery['bool'] = array();
$query1[]= array('match' => array('goodsName' => $keyword)); if (!empty($keyword)) {
// $where['storeId']=$storeId; $where= $this->getOrderIndexWhere($storeId,$keyword,$pageIndex,$pageSize);
if(!empty($orderState)){ } else {
$query1[]= array('match' => array('orderState' => $orderState)); $where = 'han_order.store_id=' . $storeId;
if (!empty($orderState)) {
$where .= ' and han_order.order_state=' . $orderState;
} }
$res2=array('must'=>$query1);
$allQuery['bool']=$res2;
//array_push($allQuery['bool'],$res2);
// echo json_encode($allQuery);exit;
// echo json_encode($allQuery);exit;
$elasticTool=ElasticsToolModel::getInstance(NameConst::ordersIndex);
$res=$elasticTool->searchMatch($allQuery,$pageIndex,$pageSize);
$orderIdsField=array_column($res['list'],'orderId');
$orderIds=implode(',',$orderIdsField);
if($orderIds){
$where=Common::format(" han_order.store_id={0} and (han_order.order_id in({1}) or han_order.order_sn like '%{2}%')",$storeId,$orderIds,$keyword);
}else{
$where=Common::format(" han_order.store_id={0} and han_order.order_sn like '%{1}%'",$storeId,$keyword);
}
}else{
$where = 'han_order.store_id=' . $storeId;
if (!empty($orderState)) {
$where .= ' and han_order.order_state=' . $orderState;
}
} }
if(!empty($where)){ if (!empty($where)) {
$returnData = $this->getRetrunDatas($where, $pageIndex, $pageSize); $returnData = $this->getRetrunDatas($storeId,$where, $pageIndex, $pageSize);
}else{ } else {
$returnData=new \stdClass(); $returnData = new \stdClass();
} }
return $returnData; return $returnData;
} }
...@@ -361,7 +377,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -361,7 +377,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$storeDao = \DAO\StoreModel::getInstance(DbNameConst::salveDBConnectName); $storeDao = \DAO\StoreModel::getInstance(DbNameConst::salveDBConnectName);
$goodsDao = \DAO\GoodsModel::getInstance(DbNameConst::salveDBConnectName); $goodsDao = \DAO\GoodsModel::getInstance(DbNameConst::salveDBConnectName);
//订单 //订单
$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));
if ($order['store_id'] != $storeId) { if ($order['store_id'] != $storeId) {
ErrorModel::throwException(CodeConfigModel::orderError); ErrorModel::throwException(CodeConfigModel::orderError);
} }
...@@ -478,13 +494,14 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -478,13 +494,14 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
} }
return $results; return $results;
} }
//任务脚本原来的方法是下面那个 //任务脚本原来的方法是下面那个
public function insertStoreMemberStatics() public function insertStoreMemberStatics()
{ {
$orderGoodDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName); $orderGoodDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName);
$orderDao=\DAO\Order\OrderModel::getInstance(); $orderDao = \DAO\Order\OrderModel::getInstance();
$storeMemberStatisticDao = \DAO\StoreMemberStatisticsModel::getInstance(DbNameConst::masterDBConnectName); $storeMemberStatisticDao = \DAO\StoreMemberStatisticsModel::getInstance(DbNameConst::masterDBConnectName);
$reufndReturnDao=\DAO\Order\RefundReturnModel::getInstance(DbNameConst::masterDBConnectName); $reufndReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::masterDBConnectName);
$gmtCreate = file_get_contents($this->baseDir . PathConst::orderGoodsCreateTime); $gmtCreate = file_get_contents($this->baseDir . PathConst::orderGoodsCreateTime);
$gmtCreate = $gmtCreate ? $gmtCreate : ApiConst::zero; $gmtCreate = $gmtCreate ? $gmtCreate : ApiConst::zero;
$beginTime = $gmtCreate; $beginTime = $gmtCreate;
...@@ -493,29 +510,29 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -493,29 +510,29 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
do { do {
$storeMemberStatisticData = $orderGoodDao->getMemberStoreStaticsByCreateTime($beginTime, $this->taskIndex, $this->taskSize); $storeMemberStatisticData = $orderGoodDao->getMemberStoreStaticsByCreateTime($beginTime, $this->taskIndex, $this->taskSize);
$storeMemberStatisticData = isset($storeMemberStatisticData['list']) ? $storeMemberStatisticData['list'] : false; $storeMemberStatisticData = isset($storeMemberStatisticData['list']) ? $storeMemberStatisticData['list'] : false;
if($storeMemberStatisticData){ if ($storeMemberStatisticData) {
$this->taskIndex++; $this->taskIndex++;
$storeId=array_column($storeMemberStatisticData,'storeId'); $storeId = array_column($storeMemberStatisticData, 'storeId');
$memberId=array_column($storeMemberStatisticData,'buyerId'); $memberId = array_column($storeMemberStatisticData, 'buyerId');
$storeIds= array_unique($storeId); $storeIds = array_unique($storeId);
$memberIds=array_unique($memberId); $memberIds = array_unique($memberId);
$goodsNumCount=$orderGoodDao->getMemberStoreOrderGoodsCount($storeIds,$memberIds); $goodsNumCount = $orderGoodDao->getMemberStoreOrderGoodsCount($storeIds, $memberIds);
$ordersCount=$orderDao->getSumAmountCountByMemberAndStoreId($storeIds,$memberIds); $ordersCount = $orderDao->getSumAmountCountByMemberAndStoreId($storeIds, $memberIds);
$refundLists=$reufndReturnDao->getRefundSuccessMoneyByStoreIdAndMemberId($storeIds,$memberIds); $refundLists = $reufndReturnDao->getRefundSuccessMoneyByStoreIdAndMemberId($storeIds, $memberIds);
if(!empty($ordersCount) && !empty($refundLists)){ if (!empty($ordersCount) && !empty($refundLists)) {
foreach($ordersCount as &$order){ foreach ($ordersCount as &$order) {
foreach($refundLists as $refund){ foreach ($refundLists as $refund) {
if($order['buyerId']==$refund['buyerId'] && $order['storeId']==$refund['storeId']){ if ($order['buyerId'] == $refund['buyerId'] && $order['storeId'] == $refund['storeId']) {
$order['orderTotal']=$order['orderTotal']-$refund['refundTotal']; $order['orderTotal'] = $order['orderTotal'] - $refund['refundTotal'];
} }
} }
} }
} }
if(!empty($goodsNumCount)){ if (!empty($goodsNumCount)) {
$storeMemberStatisticDao->addAll($goodsNumCount,'orderGoodsCount'); $storeMemberStatisticDao->addAll($goodsNumCount, 'orderGoodsCount');
} }
if(!empty($ordersCount)){ if (!empty($ordersCount)) {
$storeMemberStatisticDao->addAll($ordersCount,'orderTotal'); $storeMemberStatisticDao->addAll($ordersCount, 'orderTotal');
} }
} }
...@@ -576,7 +593,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -576,7 +593,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
{ {
$elasticsTool = ElasticsToolModel::getInstance('orders'); $elasticsTool = ElasticsToolModel::getInstance('orders');
// $elasticsTool->deleteIndex(); // $elasticsTool->deleteIndex();
$indexsFiled = array( $indexsFiled = array(
'goodsName' => array( 'goodsName' => array(
'type' => 'string', 'type' => 'string',
...@@ -627,29 +644,29 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -627,29 +644,29 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
// } // }
// $elasticsTool->postBulkDoc($indexs, 'orderId'); // $elasticsTool->postBulkDoc($indexs, 'orderId');
// } // }
$orders=$orderDao->getList($where, "order_id as orderId,order_sn as orderSn,delete_state as deleteState,order_state as orderState,add_time as addTime,store_name as storeName,buyer_id as buyerId,store_id as storeId", $this->taskIndex, $this->taskSize, array( 'add_time'=>'desc')); $orders = $orderDao->getList($where, "order_id as orderId,order_sn as orderSn,delete_state as deleteState,order_state as orderState,add_time as addTime,store_name as storeName,buyer_id as buyerId,store_id as storeId", $this->taskIndex, $this->taskSize, array('add_time' => 'desc'));
if(!empty($orders['list'])){ if (!empty($orders['list'])) {
$this->taskIndex++; $this->taskIndex++;
$indexs=array(); $indexs = array();
$orderIds=array_column($orders['list'],'orderId'); $orderIds = array_column($orders['list'], 'orderId');
$orderGoods=$orderGoodDao->getOrderGoodsByOrderIds($orderIds,'order_id as orderId,goods_name as goodsName'); $orderGoods = $orderGoodDao->getOrderGoodsByOrderIds($orderIds, 'order_id as orderId,goods_name as goodsName');
$resultOrders=Common::intergrateOneToMany($orders['list'], $orderGoods, 'orderId', 'orderId', 'orderGoods'); $resultOrders = Common::intergrateOneToMany($orders['list'], $orderGoods, 'orderId', 'orderId', 'orderGoods');
foreach($resultOrders as $result){ foreach ($resultOrders as $result) {
$one['orderId']=$result['orderId']; $one['orderId'] = $result['orderId'];
$one['orderSn']=$result['orderSn']; $one['orderSn'] = $result['orderSn'];
$namesArr=array_column($result['orderGoods'],'goodsName'); $namesArr = array_column($result['orderGoods'], 'goodsName');
$nameStr=implode(',',$namesArr); $nameStr = implode(',', $namesArr);
$one['goodsName']=$nameStr; $one['goodsName'] = $nameStr;
$one['storeName']=$result['storeName']; $one['storeName'] = $result['storeName'];
$one['deleteState']=$result['deleteState']; $one['deleteState'] = $result['deleteState'];
$one['orderState']=$result['orderState']; $one['orderState'] = $result['orderState'];
$one['storeId']=$result['storeId']; $one['storeId'] = $result['storeId'];
$one['buyerId']=$result['buyerId']; $one['buyerId'] = $result['buyerId'];
$one['addTime']=$result['addTime']; $one['addTime'] = $result['addTime'];
//$one['type']=NameConst::ordersIndex.($result['storeId'])%ApiConst::orderIndexRank; //$one['type']=NameConst::ordersIndex.($result['storeId'])%ApiConst::orderIndexRank;
array_push($indexs,$one); array_push($indexs, $one);
} }
$elasticsTool->postBulkDoc($indexs,'orderId'); $elasticsTool->postBulkDoc($indexs, 'orderId');
} }
} while ($orders['list']); } while ($orders['list']);
file_put_contents($this->baseDir . PathConst::orderLastCreateTime, TIMESTAMP); file_put_contents($this->baseDir . PathConst::orderLastCreateTime, TIMESTAMP);
...@@ -683,8 +700,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -683,8 +700,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
{ {
$refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName); $refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName);
$storeMemberStatisticDao = \DAO\StoreMemberStatisticsModel::getInstance(DbNameConst::masterDBConnectName); $storeMemberStatisticDao = \DAO\StoreMemberStatisticsModel::getInstance(DbNameConst::masterDBConnectName);
$orderGoodsDao=\DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName); $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName);
$orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName); $orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName);
$gmtUpdate = file_get_contents($this->baseDir . PathConst::refundRetrunGmtUpdate); $gmtUpdate = file_get_contents($this->baseDir . PathConst::refundRetrunGmtUpdate);
$gmtUpdate = $gmtUpdate ? $gmtUpdate : ApiConst::zero; $gmtUpdate = $gmtUpdate ? $gmtUpdate : ApiConst::zero;
$this->taskIndex = PageConst::taskPageBegin; $this->taskIndex = PageConst::taskPageBegin;
...@@ -692,15 +709,15 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -692,15 +709,15 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
do { do {
$storeMemberStatisticData = $refundReturnDao->getMemberStoreStaticsByGmtUpdate($gmtUpdate, $this->taskIndex, $this->taskSize); $storeMemberStatisticData = $refundReturnDao->getMemberStoreStaticsByGmtUpdate($gmtUpdate, $this->taskIndex, $this->taskSize);
$storeMemberStatisticData = isset($storeMemberStatisticData['list']) ? $storeMemberStatisticData['list'] : false; $storeMemberStatisticData = isset($storeMemberStatisticData['list']) ? $storeMemberStatisticData['list'] : false;
if(!empty($storeMemberStatisticData)){ if (!empty($storeMemberStatisticData)) {
foreach($storeMemberStatisticData as $item){ foreach ($storeMemberStatisticData as $item) {
$orderDao->deleteOrderCache($item['buyerId'],$item['orderId'],$item['storeId'],true,true); $orderDao->deleteOrderCache($item['buyerId'], $item['orderId'], $item['storeId'], true, true);
} }
$orderIds=array_column($storeMemberStatisticData,'orderId'); $orderIds = array_column($storeMemberStatisticData, 'orderId');
foreach($orderIds as $orderId){ foreach ($orderIds as $orderId) {
$res=$orderGoodsDao->find(array('order_id'=>$orderId,'refund_id'=>ApiConst::zero)); $res = $orderGoodsDao->find(array('order_id' => $orderId, 'refund_id' => ApiConst::zero));
if(empty($res)){ if (empty($res)) {
$orderDao->update(array('order_id'=>$orderId),array('order_state'=>ApiConst::orderStateClose)); $orderDao->update(array('order_id' => $orderId), array('order_state' => ApiConst::orderStateClose));
} }
} }
} }
......
...@@ -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();
......
...@@ -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);
} }
......
...@@ -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