Commit df234ec7 authored by liuyuzhen's avatar liuyuzhen

购物车下单是删除购物车缓存

parent 0356bcb4
...@@ -41,6 +41,8 @@ class OrderConfirmUtil { ...@@ -41,6 +41,8 @@ class OrderConfirmUtil {
private $storeMemos = array(); private $storeMemos = array();
private $cartCacheDeleteFlag = false;
public function addOrder($data,$memberId,$currentAddress){ public function addOrder($data,$memberId,$currentAddress){
$storeCartData = $this->checkPostData($data,$memberId,$currentAddress); $storeCartData = $this->checkPostData($data,$memberId,$currentAddress);
//return $storeCartData; //return $storeCartData;
...@@ -89,6 +91,7 @@ class OrderConfirmUtil { ...@@ -89,6 +91,7 @@ class OrderConfirmUtil {
$this->storeIds= array_keys($cartList['list']); $this->storeIds= array_keys($cartList['list']);
$this->storeMemos[$this->postData['storeId']] = isset($this->postData['storeMemo'])?$this->postData['storeMemo']:\Our\NameConst::emptyString; $this->storeMemos[$this->postData['storeId']] = isset($this->postData['storeMemo'])?$this->postData['storeMemo']:\Our\NameConst::emptyString;
}else{ }else{
$this->cartCacheDeleteFlag = true;
foreach($this->postData as $temp){ foreach($this->postData as $temp){
$this->checkOneStoreData($temp); $this->checkOneStoreData($temp);
if(!$temp['cartIds']){ if(!$temp['cartIds']){
...@@ -513,10 +516,23 @@ class OrderConfirmUtil { ...@@ -513,10 +516,23 @@ class OrderConfirmUtil {
} }
public function opCacheInfo(){ public function opCacheInfo(){
if($this->cartCacheDeleteFlag){
$this->delCartCache();
}
$this->deleteCacheInfo(); $this->deleteCacheInfo();
$this->pushSaleGoods(); $this->pushSaleGoods();
} }
public function delCartCache(){
$cartRedis = \Redis\Db7\CartRedisModel::getInstance();
$memberCartKey = \Our\NameConst::memberCartStorePrefix.$this->memberId;
$cartRedis->tableDel($memberCartKey);
foreach($this->storeIds as $tempStoreId){
$memberStoreCartsKey = \Our\NameConst::memberStoreCartsPrefix.$this->memberId.\Our\NameConst::underline.$tempStoreId;
$cartRedis->tableDel($memberStoreCartsKey);
}
}
public function pushSaleGoods(){ public function pushSaleGoods(){
if($this->saleGoodsIds){ if($this->saleGoodsIds){
$saleGoodsDao = \DAO\SaleGoodsModel::getInstance(); $saleGoodsDao = \DAO\SaleGoodsModel::getInstance();
......
...@@ -157,8 +157,8 @@ class AdvServiceModel extends \Business\AbstractModel{ ...@@ -157,8 +157,8 @@ class AdvServiceModel extends \Business\AbstractModel{
$advMobileSql = \Our\Common::format($advMobileSql,$where['storeId'],$position,\Our\ApiConst::one,\Our\ApiConst::one); $advMobileSql = \Our\Common::format($advMobileSql,$where['storeId'],$position,\Our\ApiConst::one,\Our\ApiConst::one);
$advMobileField = 'href,src,end_time,start_time'; $advMobileField = 'href,src,end_time,start_time';
$advMobileList = \Our\RedisHelper::cachedFunction(\Redis\Db9\AdvMobileRedisModel::getInstance(),array(&$advMobileDao, 'getList'),array($advMobileSql,$advMobileField,array('adv_id'=>\Our\NameConst::desc)),\Our\ApiConst::oneHour,array($where['storeId'])); $advMobileList = \Our\RedisHelper::cachedFunction(\Redis\Db9\AdvMobileRedisModel::getInstance(),array(&$advMobileDao, 'getList'),array($advMobileSql,$advMobileField,array('adv_id'=>\Our\NameConst::desc)),\Our\ApiConst::oneHour,array($where['storeId']));
$advs = array();
if($advMobileList){ if($advMobileList){
$advs = array();
foreach($advMobileList as $adv){ foreach($advMobileList as $adv){
if($adv['start_time']<=TIMESTAMP&&$adv['end_time']>TIMESTAMP){ if($adv['start_time']<=TIMESTAMP&&$adv['end_time']>TIMESTAMP){
$temp = array(); $temp = array();
...@@ -167,7 +167,7 @@ class AdvServiceModel extends \Business\AbstractModel{ ...@@ -167,7 +167,7 @@ class AdvServiceModel extends \Business\AbstractModel{
$advs[] = $temp; $advs[] = $temp;
} }
} }
}else{ }/*else{
$storeAdvPositionDao = \DAO\Adv\StoreAdvPositionModel::getInstance(); $storeAdvPositionDao = \DAO\Adv\StoreAdvPositionModel::getInstance();
$storeAdvPosition = \Our\RedisHelper::cachedFunction(\Redis\Db9\StoreAdvPositionRedisModel::getInstance(),array(&$storeAdvPositionDao, 'find'),array(array('ap_id'=>$position)),\Our\ApiConst::oneHour,array($position)); $storeAdvPosition = \Our\RedisHelper::cachedFunction(\Redis\Db9\StoreAdvPositionRedisModel::getInstance(),array(&$storeAdvPositionDao, 'find'),array(array('ap_id'=>$position)),\Our\ApiConst::oneHour,array($position));
if($storeAdvPosition&&$storeAdvPosition['default_content']){ if($storeAdvPosition&&$storeAdvPosition['default_content']){
...@@ -176,7 +176,7 @@ class AdvServiceModel extends \Business\AbstractModel{ ...@@ -176,7 +176,7 @@ class AdvServiceModel extends \Business\AbstractModel{
}else{ }else{
$advs = array(); $advs = array();
} }
} }*/
return $advs; return $advs;
} }
......
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