Commit 30003491 authored by wwccw0591's avatar wwccw0591

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

parents 74cca24f 91cae03a
...@@ -36,7 +36,6 @@ class CartController extends \Our\Controller_AbstractApi{ ...@@ -36,7 +36,6 @@ class CartController extends \Our\Controller_AbstractApi{
$data['pageIndex'] = $pageIndex; $data['pageIndex'] = $pageIndex;
$data['pageSize'] = $pageSize; $data['pageSize'] = $pageSize;
$storeCartList = $cartService->getCart($data,$this->memberId); $storeCartList = $cartService->getCart($data,$this->memberId);
$pBundlingService = \Business\Goods\GroupSaleServiceModel::getInstance(); $pBundlingService = \Business\Goods\GroupSaleServiceModel::getInstance();
$sess=\Yaf\Session::getInstance(); $sess=\Yaf\Session::getInstance();
$currentAddress = $sess->get('currentAddress'); $currentAddress = $sess->get('currentAddress');
......
...@@ -41,5 +41,6 @@ class CouponController extends \Our\Controller_AbstractIndex{ ...@@ -41,5 +41,6 @@ class CouponController extends \Our\Controller_AbstractIndex{
$couponList = $couponService->getGoodsCoupons($data,$memberId); $couponList = $couponService->getGoodsCoupons($data,$memberId);
$this->success($couponList); $this->success($couponList);
} }
} }
...@@ -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;
} }
......
...@@ -270,7 +270,8 @@ class CouponServiceModel extends \Business\AbstractModel{ ...@@ -270,7 +270,8 @@ class CouponServiceModel extends \Business\AbstractModel{
public function getStorePromotionCouponTitles($where){ public function getStorePromotionCouponTitles($where){
$this->validCouponStore($where); $this->validCouponStore($where);
$couponDao = \DAO\Coupon\CouponModel::getInstance(); $couponDao = \DAO\Coupon\CouponModel::getInstance();
$couponTitles = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$couponDao, 'getStorePromotionCouponList'),array($where['storeId']),\Our\ApiConst::oneHour,array($where['storeId'])); $couponTitles = $couponDao->getStorePromotionCouponList($where['storeId']);
//\Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$couponDao, 'getStorePromotionCouponList'),array($where['storeId']),\Our\ApiConst::oneHour,array($where['storeId']));
return $couponTitles?$couponTitles:array(); return $couponTitles?$couponTitles:array();
} }
...@@ -376,22 +377,6 @@ class CouponServiceModel extends \Business\AbstractModel{ ...@@ -376,22 +377,6 @@ class CouponServiceModel extends \Business\AbstractModel{
return $couponList; return $couponList;
} }
/**
* 删除店铺优惠券缓存
* @param $storeId 店铺ID
* @param bool $couponId 指定优惠券ID
* @throws \Our\Exception
*/
public function deleteCouponCache($storeId,$couponId=false){
$couponDao = \DAO\Coupon\CouponModel::getInstance();
$memberCouponDao = \DAO\Coupon\MemberCouponModel::getInstance();
if($couponId){
\Our\RedisHelper::delCachedFunction(\Redis\Db13\MemberCouponRedisModel::getInstance(), array(&$memberCouponDao, 'getList'),array(),array($couponId));
}
\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$couponDao, 'getStorePromotionCouponList'),array(),array($storeId));
\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStoreCouponsById'),array(),array($storeId));
}
public function sortCouponList($couponList){ public function sortCouponList($couponList){
foreach($couponList as $key => $coupon){ foreach($couponList as $key => $coupon){
$isGet[$key] = $coupon['isGet']; $isGet[$key] = $coupon['isGet'];
......
...@@ -8,6 +8,8 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -8,6 +8,8 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
private $pBundingField = 'han_p_bundling.bl_id AS blId,bl_name AS name,bl_title,store_id,store_name,bl_state,bl_quota_starttime,bl_image,bl_storage,bl_discount_price AS discountPrice,bl_sum_price AS sumPrice,bl_quota_endtime AS endTime,image,is_transport,transport_id,snapshot_id,goods_freight,goods_free'; private $pBundingField = 'han_p_bundling.bl_id AS blId,bl_name AS name,bl_title,store_id,store_name,bl_state,bl_quota_starttime,bl_image,bl_storage,bl_discount_price AS discountPrice,bl_sum_price AS sumPrice,bl_quota_endtime AS endTime,image,is_transport,transport_id,snapshot_id,goods_freight,goods_free';
private $pBundingFieldWithDel = 'han_p_bundling.bl_id AS blId,bl_name AS name,bl_title,store_id,store_name,bl_state,bl_quota_starttime,bl_image,bl_storage,bl_discount_price AS discountPrice,bl_sum_price AS sumPrice,bl_quota_endtime AS endTime,image,is_transport,transport_id,snapshot_id,goods_freight,goods_free,is_del';
private $pBundingGoodsField = 'bl_count_price AS discountPrice,num,goods_id,bl_id'; private $pBundingGoodsField = 'bl_count_price AS discountPrice,num,goods_id,bl_id';
private $pBundingGoodsDetailField = 'goods_id,goods_commonid AS goodsCommonId,goods_name AS goodsName,goods_image,goods_spec,goods_storage AS goodsStorage,goods_price AS goodsPrice,goods_state,goods_verify,is_del'; private $pBundingGoodsDetailField = 'goods_id,goods_commonid AS goodsCommonId,goods_name AS goodsName,goods_image,goods_spec,goods_storage AS goodsStorage,goods_price AS goodsPrice,goods_state,goods_verify,is_del';
...@@ -116,7 +118,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -116,7 +118,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
}*/ }*/
//$pBundlingList = $this->getGroupListForCart($blIds); //$pBundlingList = $this->getGroupListForCart($blIds);
//var_dump($pBundlingList); //var_dump($pBundlingList);
$pBundlingList = $this->getPBundlingListByBlIds($blIds,\Our\DbNameConst::salveDBConnectName,true); $pBundlingList = $this->getPBundlingListByBlIds($blIds,\Our\DbNameConst::salveDBConnectName,array(),true,\Our\ApiConst::one);
$pBundlingList = $this->getResizeGroupSaleGoodsList($pBundlingList); $pBundlingList = $this->getResizeGroupSaleGoodsList($pBundlingList);
} }
$goodsCommonIds = $cartListData['goodsCommonIds']; $goodsCommonIds = $cartListData['goodsCommonIds'];
...@@ -150,7 +152,9 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -150,7 +152,9 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
if (!$pBundling) { if (!$pBundling) {
$tempObj['goodsState'] = \Our\ApiConst::cartGoodsOffline; $tempObj['goodsState'] = \Our\ApiConst::cartGoodsOffline;
} else if (!($pBundling['bl_state'] == \Our\ApiConst::one && ($pBundling['bl_quota_starttime'] < time() && $pBundling['endTime'] >= time()))||!$pBundling['goodsCountFlag']) { } else if(isset($pBundling['is_del'])&&$pBundling['is_del']==\Our\ApiConst::one){
$tempObj['goodsState'] = \Our\ApiConst::cartGoodsOffline;
}else if (!($pBundling['bl_state'] == \Our\ApiConst::one && ($pBundling['bl_quota_starttime'] < time() && $pBundling['endTime'] >= time()))||!$pBundling['goodsCountFlag']) {
$tempObj['goodsState'] = \Our\ApiConst::cartGoodsOffline; $tempObj['goodsState'] = \Our\ApiConst::cartGoodsOffline;
} else { } else {
if($pBundling['bl_storage']<=\Our\ApiConst::zero){ if($pBundling['bl_storage']<=\Our\ApiConst::zero){
...@@ -164,9 +168,11 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -164,9 +168,11 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
}else{ }else{
$tempObj['blChangeFlag'] = \Our\ApiConst::one; $tempObj['blChangeFlag'] = \Our\ApiConst::one;
} }
$tempPrice = \Goods\GoodsUtil::getInstance()->getRealPrice($pBundling['blId'],null,null,\Our\ApiConst::addBundingToCart,\Our\DbNameConst::salveDBConnectName); if($tempObj['goodsState'] != \Our\ApiConst::cartGoodsOffline){
if($tempPrice){ $tempPrice = \Goods\GoodsUtil::getInstance()->getRealPrice($pBundling['blId'],null,null,\Our\ApiConst::addBundingToCart,\Our\DbNameConst::salveDBConnectName);
$tempObj['goodsPrice'] = $tempPrice; if($tempPrice){
$tempObj['goodsPrice'] = $tempPrice;
}
} }
$tempObj['goodsImage'] = $pBundling['image']; $tempObj['goodsImage'] = $pBundling['image'];
...@@ -190,8 +196,10 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -190,8 +196,10 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
}else{ }else{
$tempObj['goodsState'] = \Our\ApiConst::cartGoodsOffline; $tempObj['goodsState'] = \Our\ApiConst::cartGoodsOffline;
} }
$price = \Goods\GoodsUtil::getInstance()->getRealPrice($tempCart['goods_id'],$memberId); if($tempObj['goodsState'] != \Our\ApiConst::cartGoodsOffline){
$tempObj['goodsPrice'] = $price?$price:$tempObj['goodsPrice']; $price = \Goods\GoodsUtil::getInstance()->getRealPrice($tempCart['goods_id'],$memberId);
$tempObj['goodsPrice'] = $price?$price:$tempObj['goodsPrice'];
}
} }
$tempObj['goodsAttr'] = $goodsDao->getFormatGoodsAttr($tempCart['goods_spec']); $tempObj['goodsAttr'] = $goodsDao->getFormatGoodsAttr($tempCart['goods_spec']);
$tempObj['goodsMid'] = $tempCart['goods_mid']; $tempObj['goodsMid'] = $tempCart['goods_mid'];
...@@ -303,12 +311,25 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -303,12 +311,25 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
* 获取组合销售商品列表 * 获取组合销售商品列表
* @param $blIds * @param $blIds
*/ */
public function getPBundlingListByBlIds($blIds,$dbName = \Our\DbNameConst::salveDBConnectName,$withKeyFlag= false){
/**
* @param $blIds
* @param string $dbName
* @param bool $withKeyFlag
* @param int $isDel 是否包含已经删除的数据(0:不包含已删除数据, 1 包含已删除数据)
* @return array|bool
* @throws \Our\Exception
*/
public function getPBundlingListByBlIds($blIds,$dbName = \Our\DbNameConst::salveDBConnectName,$limit=array(\Our\ApiConst::zero,\Our\ApiConst::five),$withKeyFlag= false,$isDel=\Our\ApiConst::zero){
if(!$blIds){ if(!$blIds){
return false; return false;
} }
$field = $this->pBundingField;
if($isDel==\Our\ApiConst::one){
$field = $this->pBundingFieldWithDel;
}
$pbundlingInstance = \DAO\PBundlingModel::getInstance(\Our\DbNameConst::salveDBConnectName); $pbundlingInstance = \DAO\PBundlingModel::getInstance(\Our\DbNameConst::salveDBConnectName);
$groupList = \Our\RedisHelper::cachedFunction(\Redis\Db4\PBundlingRedisModel::getInstance(),array(&$pbundlingInstance, 'getList'),array($this->pBundingField,array('bl_id'=>array('in',$blIds)),array(\Our\ApiConst::zero,\Our\ApiConst::five)),\Our\ApiConst::oneDaySecond,array(implode(',',$blIds))); $groupList = \Our\RedisHelper::cachedFunction(\Redis\Db4\PBundlingRedisModel::getInstance(),array(&$pbundlingInstance, 'getList'),array($field,array('bl_id'=>array('in',$blIds)),$limit,$isDel),\Our\ApiConst::oneDaySecond,array(implode(',',$blIds)));
$newGroupList = $this->getPBundlingList($groupList,$dbName,$withKeyFlag); $newGroupList = $this->getPBundlingList($groupList,$dbName,$withKeyFlag);
return $newGroupList; return $newGroupList;
} }
...@@ -536,7 +557,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -536,7 +557,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
//unset($goods_temp['goods_image']); //unset($goods_temp['goods_image']);
//unset($goods_temp['bl_id']); //unset($goods_temp['bl_id']);
//$goodsArray[] =$goods_temp; //unset($goods_temp['goods_image']); //$goodsArray[] =$goods_temp; //unset($goods_temp['goods_image']);
if(!$goods_temp['goods_state']==\Our\ApiConst::onlineGoodsState&&$goods_temp['goods_verify']==\Our\ApiConst::onlineGoodsVerify&&$goods_temp['is_del']==\Our\ApiConst::onlineGoodsDel){ if(!($goods_temp['goods_state']==\Our\ApiConst::onlineGoodsState&&$goods_temp['goods_verify']==\Our\ApiConst::onlineGoodsVerify&&$goods_temp['is_del']==\Our\ApiConst::onlineGoodsDel)){
$tempGroup['goodsCountFlag'] = false; $tempGroup['goodsCountFlag'] = false;
} }
if($tempGroup['bl_storage']>0&&floor($goods_temp['goodsStorage']/$goods_temp['num'])<$tempGroup['bl_storage']){ if($tempGroup['bl_storage']>0&&floor($goods_temp['goodsStorage']/$goods_temp['num'])<$tempGroup['bl_storage']){
...@@ -583,7 +604,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -583,7 +604,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
/*foreach($blIds as $val){ /*foreach($blIds as $val){
$group[]['blId']=$val; $group[]['blId']=$val;
}*/ }*/
$pBundlingList = $this->getPBundlingListByBlIds($blIds,$dbName,true); $pBundlingList = $this->getPBundlingListByBlIds($blIds,$dbName,array(),true);
} }
$goodsCommonIds = $cartListData['goodsCommonIds']; $goodsCommonIds = $cartListData['goodsCommonIds'];
$goodsIds = $cartListData['goodsIds']; $goodsIds = $cartListData['goodsIds'];
......
...@@ -317,7 +317,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -317,7 +317,7 @@ class OrderServiceModel extends \Business\AbstractModel
} }
} }
if ($memberId) { if ($memberId) {
$orderDao->deleteOrderCache($memberId, $orderId, $order['store_id'],true); $orderDao->deleteOrderCache($memberId, $orderId, $order['storeId'],true);
// $memberDao->fromOrderStateToOrderState($memberId,$order['order_state'],ApiConst::orderStateCancel); // $memberDao->fromOrderStateToOrderState($memberId,$order['order_state'],ApiConst::orderStateCancel);
} }
} }
......
...@@ -54,7 +54,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -54,7 +54,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$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::one, 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));
......
...@@ -553,6 +553,9 @@ class AddressServiceModel extends \Business\AbstractModel { ...@@ -553,6 +553,9 @@ class AddressServiceModel extends \Business\AbstractModel {
if(!($address['citycode'])){ if(!($address['citycode'])){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyCityCodeForSave); \Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyCityCodeForSave);
} }
if(intval($address['citycode'])<=0){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::wrongCityCode);
}
if(!($address['lng']&&$address['lat'])){ if(!($address['lng']&&$address['lat'])){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::chooseAddressFormMap); \Error\ErrorModel::throwException(\Error\CodeConfigModel::chooseAddressFormMap);
} }
......
...@@ -281,10 +281,10 @@ class MemberCenterServiceModel extends \Business\AbstractModel ...@@ -281,10 +281,10 @@ class MemberCenterServiceModel extends \Business\AbstractModel
//删除缓存 //删除缓存
if(is_array($ids) && count($ids) <= 20){ if(is_array($ids) && count($ids) <= 20){
foreach ($ids as $v){ foreach ($ids as $v){
\Our\RedisHelper::delCachedFunction(\Redis\Db4\FavoritesRedisModel::getInstance(),array(&$favoritesInstance, 'getOne'),array('*',array('goods_commonid'=>$v,'member_id'=>$memberId)),array($memberId)); \Our\RedisHelper::delCachedFunction(\Redis\Db4\FavoritesRedisModel::getInstance(),array(&$favoritesInstance, 'getOne'),array('*',array('member_id'=>$memberId,'goods_commonid'=>$v)),array($memberId));
} }
}elseif (!is_array($ids)){ }elseif (!is_array($ids)){
\Our\RedisHelper::delCachedFunction(\Redis\Db4\FavoritesRedisModel::getInstance(),array(&$favoritesInstance, 'getOne'),array('*',array('goods_commonid'=>$ids,'member_id'=>$memberId)),array($memberId)); \Our\RedisHelper::delCachedFunction(\Redis\Db4\FavoritesRedisModel::getInstance(),array(&$favoritesInstance, 'getOne'),array('*',array('member_id'=>$memberId,'goods_commonid'=>$ids)),array($memberId));
}else{ }else{
\Our\RedisHelper::delCachedFunction(\Redis\Db4\FavoritesRedisModel::getInstance(),array(&$favoritesInstance, 'getOne'),array(),array($memberId)); \Our\RedisHelper::delCachedFunction(\Redis\Db4\FavoritesRedisModel::getInstance(),array(&$favoritesInstance, 'getOne'),array(),array($memberId));
} }
......
...@@ -152,9 +152,9 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -152,9 +152,9 @@ class CouponModel extends \DAO\AbstractModel {
$field = $this->availStoreIndexField; $field = $this->availStoreIndexField;
$where = ' and store_id ='.$storeId.' and type<>1'; $where = ' and store_id ='.$storeId.' and type<>1';
$this->setDb($this->dbName); $this->setDb($this->dbName);
$coupons = $this->getOnlineCouponList($where,$field); //$coupons = $this->getOnlineCouponList($where,$field);
//$coupons = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getOnlineCouponList'),array($where,$field),\Our\ApiConst::oneHour); $coupons = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getOnlineCouponList'),array($where,$field),\Our\ApiConst::oneHour,array($storeId));
//$coupons = $this->getOnlineCouponList($where,$field); //$coupons = $this->getOnlineCouponList($where,$field);
if(!$coupons){ if(!$coupons){
...@@ -169,6 +169,9 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -169,6 +169,9 @@ class CouponModel extends \DAO\AbstractModel {
$storeCouponGoodsClassDao = \DAO\GoodsClass\StoreCouponGoodsClassModel::getInstance(); $storeCouponGoodsClassDao = \DAO\GoodsClass\StoreCouponGoodsClassModel::getInstance();
$result = array(); $result = array();
foreach($coupons as $coupon){ foreach($coupons as $coupon){
if(!($coupon['start_time']<=TIMESTAMP&&$coupon['end_time']>TIMESTAMP)){
continue;
}
if($coupon['type']==\Our\ApiConst::goodsClassCoupon){ //指定品类优惠券,需要判断该优惠券对应分类店铺是否在经营 if($coupon['type']==\Our\ApiConst::goodsClassCoupon){ //指定品类优惠券,需要判断该优惠券对应分类店铺是否在经营
if($storeClassIds){ if($storeClassIds){
$gcIds = $storeCouponGoodsClassDao->getGoodsClassIdsByCouponId($coupon['id']); $gcIds = $storeCouponGoodsClassDao->getGoodsClassIdsByCouponId($coupon['id']);
...@@ -489,6 +492,27 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -489,6 +492,27 @@ class CouponModel extends \DAO\AbstractModel {
} }
} }
/**
* 删除店铺优惠券缓存
* @param $storeId 店铺ID
* @param bool $couponId 指定优惠券ID
* @throws \Our\Exception
*/
public function deleteCouponCache($storeId,$couponId=false){
$couponService = \Business\Coupon\CouponServiceModel::getInstance();
$memberCouponDao = \DAO\Coupon\MemberCouponModel::getInstance();
if($couponId){
\Our\RedisHelper::delCachedFunction(\Redis\Db13\MemberCouponRedisModel::getInstance(), array(&$memberCouponDao, 'getList'),array(),array($couponId));
}
//\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStorePromotionCouponList'),array(),array($storeId));
\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$couponService, 'getStoreCouponsById'),array(),array($storeId));
\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getOnlineCouponList'),array(),array($storeId));
return true;
}
public function getDb() public function getDb()
{ {
return $this->db; return $this->db;
...@@ -513,4 +537,5 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -513,4 +537,5 @@ class CouponModel extends \DAO\AbstractModel {
} }
...@@ -149,6 +149,7 @@ class DeliveryFormulaModel extends \DAO\AbstractModel { ...@@ -149,6 +149,7 @@ class DeliveryFormulaModel extends \DAO\AbstractModel {
break; break;
} }
} }
$expriseStartTime += $deliveryIntval*\Our\ApiConst::oneMinute;
if($expriseStartTime<$todayEndTime){ if($expriseStartTime<$todayEndTime){
$expriseData = $this->getTomorrowFormulaList($expriseStartTime,$todayEndTime,$deliveryIntval*\Our\ApiConst::oneMinute,$minFee,$myCurrentStartTime); $expriseData = $this->getTomorrowFormulaList($expriseStartTime,$todayEndTime,$deliveryIntval*\Our\ApiConst::oneMinute,$minFee,$myCurrentStartTime);
if($expriseData){ if($expriseData){
......
...@@ -54,6 +54,7 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -54,6 +54,7 @@ class OrderGoodsModel extends \DAO\AbstractModel {
*/ */
public function update($where, $data){ public function update($where, $data){
$this->setDb(DbNameConst::masterDBConnectName); $this->setDb(DbNameConst::masterDBConnectName);
$data['gmt_update']=TIMESTAMP;
return $this->db->update($this->_tableName)->where($where)->rows($data)->execute(); return $this->db->update($this->_tableName)->where($where)->rows($data)->execute();
} }
......
...@@ -33,12 +33,28 @@ class PBundlingModel extends \DAO\AbstractModel { ...@@ -33,12 +33,28 @@ class PBundlingModel extends \DAO\AbstractModel {
// $where = array(); // $where = array();
// $groupList=$this->db->select($field)->from($this->_tableName)->where($where)->order('gmt_create','DESC')->fetchOne(); // $groupList=$this->db->select($field)->from($this->_tableName)->where($where)->order('gmt_create','DESC')->fetchOne();
// } // }
public function getList($field,$where,$limit = array(0,0)){
/**
* @param $field
* @param $where
* @param array $limit
* @param int $isDel 是否包含已删除数据(0:不包含,1包含)
* @return mixed
*/
public function getList($field,$where,$limit = [],$isDel = \Our\ApiConst::zero){
$this->setDb($this->dbName); $this->setDb($this->dbName);
if(is_array($where)){ if(is_array($where)){
$where = $this->db->getSqlWhereByArray($where); $where = $this->db->getSqlWhereByArray($where);
} }
return $this->db->select($field)->from($this->_tableName)->where($where)->where("bl_quota_starttime <= ".time())->where('bl_quota_endtime >= '.time())->where('bl_state=1')->where('is_del=0')->limit($limit[0],$limit[1])->fetchAll(); $this->db->select($field)->from($this->_tableName)->where($where)->where("bl_quota_starttime <= ".time())->where('bl_quota_endtime >= '.time())->where('bl_state=1');
if($isDel==\Our\ApiConst::zero){
$this->db->where('is_del=0');
}
if($limit){
$this->db->limit($limit[0],$limit[1]);
}
$result = $this->db->fetchAll();
return $result;
} }
public function getImgPath($image){ public function getImgPath($image){
if($image){ if($image){
......
...@@ -367,6 +367,7 @@ class CodeConfigModel { ...@@ -367,6 +367,7 @@ class CodeConfigModel {
const emptyDistrictId = 140020; const emptyDistrictId = 140020;
const emptyAddressAndName = 140021; const emptyAddressAndName = 140021;
const wrongAddressTagType = 140022; const wrongAddressTagType = 140022;
const wrongCityCode = 140023;
//消息,推送等 //消息,推送等
const removeMessage=150001; const removeMessage=150001;
...@@ -599,6 +600,7 @@ class CodeConfigModel { ...@@ -599,6 +600,7 @@ class CodeConfigModel {
self::emptyDistrictId => '找不到对应区', self::emptyDistrictId => '找不到对应区',
self::emptyAddressAndName => '地址和具体街道不能为空', self::emptyAddressAndName => '地址和具体街道不能为空',
self::wrongAddressTagType => '地址标签传输错误', self::wrongAddressTagType => '地址标签传输错误',
self::wrongCityCode => '城市码格式错误',
self::emptyLatLng => '经纬度不能为空', self::emptyLatLng => '经纬度不能为空',
self::emptyCityCode => '高德地图城市编码不能为空', self::emptyCityCode => '高德地图城市编码不能为空',
......
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