Commit ce3fcef7 authored by zhz's avatar zhz

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

parents a055929f 8aa3900c
......@@ -164,11 +164,21 @@ class CouponServiceModel extends \Business\AbstractModel{
}
$couponDao->db->doCommit();
\Our\RedisHelper::delCachedFunction(\Redis\Db13\MemberCouponRedisModel::getInstance(), array(&$memberCouponDao, 'getList'),array(),array($memberId));
\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStoreCouponsById'),array(),array($coupon['store_id']."_".$memberId));
return true;
}
/**
* 购物车多店下单涉及到赠券时使用
* @param $coupons
* @param $memberId
* @param int $orderId
* @return bool
* @throws \Error\OurExceptionModel
* @throws \Exception
* @throws \Our\Exception
*/
public function receiveCouponBatch($coupons,$memberId,$orderId=\Our\ApiConst::zero){
$dbName = \Our\DbNameConst::masterDBConnectName;
$couponDao = \DAO\Coupon\CouponModel::getInstance($dbName);
......@@ -268,7 +278,7 @@ class CouponServiceModel extends \Business\AbstractModel{
public function getStoreCoupons($where,$memberId = null){
$couponDao = \DAO\Coupon\CouponModel::getInstance();
$couponDao->validStoreCouponParam($where);
$couponList = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStoreCouponsById'),array($where['storeId'],$memberId),\Our\ApiConst::oneHour,array($where['storeId']));
$couponList = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStoreCouponsById'),array($where['storeId'],$memberId),\Our\ApiConst::oneHour,array($where['storeId']."_".$memberId));
if($couponList){
$couponList = array_values($couponList);
}
......@@ -279,7 +289,7 @@ class CouponServiceModel extends \Business\AbstractModel{
$this->validCouponStore($where);
$couponDao = \DAO\Coupon\CouponModel::getInstance();
$couponDao->validStoreCouponParam($where);
$couponList = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStoreCouponsById'),array($where['storeId'],$memberId,true),\Our\ApiConst::oneHour,array($where['storeId']));
$couponList = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStoreCouponsById'),array($where['storeId'],$memberId,\Our\ApiConst::one),\Our\ApiConst::oneHour,array($where['storeId']."_".$memberId));
if($couponList){
$couponList = array_values($couponList);
if(count($couponList)>=\Our\ApiConst::defaultCouponTitleLength){
......@@ -315,7 +325,7 @@ class CouponServiceModel extends \Business\AbstractModel{
* @param $memberId 会员ID
* @return array|bool
*/
public function getStoreCouponsById($storeId,$memberId,$timeFlag = false){
public function getStoreCouponsById($storeId,$memberId,$timeFlag = \Our\ApiConst::zero){
$couponDao = \DAO\Coupon\CouponModel::getInstance();
$couponList = $couponDao->getStoreIndexCouponList($storeId,$timeFlag);
if(!$couponList){
......@@ -348,10 +358,12 @@ class CouponServiceModel extends \Business\AbstractModel{
if(in_array(\Our\ApiConst::availCouponState,$couponStates)){
$coupon['isGet'] = \Our\ApiConst::one;
}else{
$coupon['isGet'] = \Our\ApiConst::zero;
$coupon[ 'isGet'] = \Our\ApiConst::zero;
}
}
}
}else{
$coupon['isGet'] = \Our\ApiConst::zero;
}
unset($coupon['is_overlay']);
}
......
......@@ -150,7 +150,7 @@ class CouponModel extends \DAO\AbstractModel {
*/
public function getStorePromotionCouponList($storeId){
$field = $this->availStoreIndexField;
$where = ' and store_id in( '.$storeId.',0) and type<>1';
$where = ' and store_id ='.$storeId.' and type<>1';
$this->setDb($this->dbName);
$coupons = $this->getOnlineCouponList($where,$field);
......@@ -215,7 +215,7 @@ class CouponModel extends \DAO\AbstractModel {
*/
public function getStoreCouponList($storeId){
$field = $this->availStoreIndexField;
$where = ' and store_id in( '.$storeId.',0)';
$where = ' and store_id = '. $storeId ;
$coupons = $this->getOnlineCouponList($where,$field);
//$coupons = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getOnlineCouponList'),array($where,$field),\Our\ApiConst::oneHour);
return $coupons;
......@@ -261,7 +261,7 @@ class CouponModel extends \DAO\AbstractModel {
* @param $storeId 店铺Id
* @return array
*/
public function getStoreIndexCouponList($storeId,$timeFlag= false){
public function getStoreIndexCouponList($storeId,$timeFlag= \Our\ApiConst::zero){
$coupons = $this->getStoreCouponList($storeId);
if($coupons){
$result = array();
......
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