Commit ccd9b46b authored by wwccw0591's avatar wwccw0591

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

parents 3bef361f 4daa83ec
...@@ -24,6 +24,7 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -24,6 +24,7 @@ class CouponModel extends \DAO\AbstractModel {
protected $_primaryKey = 'id'; protected $_primaryKey = 'id';
protected $availStoreIndexField = 'id,type,FORMAT(cash_money/100,2) as cash_money,FORMAT(order_amount/100,2) as order_amount,discount,store_id,coupon_type,is_overlay,start_time,end_time,gift_coupon_id'; protected $availStoreIndexField = 'id,type,FORMAT(cash_money/100,2) as cash_money,FORMAT(order_amount/100,2) as order_amount,discount,store_id,coupon_type,is_overlay,start_time,end_time,gift_coupon_id';
protected $availTitleField = 'id,type,FORMAT(cash_money/100,2) as cash_money,FORMAT(order_amount/100,2) as order_amount,discount,store_id,coupon_type,is_overlay,start_time,end_time,gift_coupon_id,ids';
protected $availCartStoreIndexField = 'id,type,FORMAT(cash_money/100,2) as cash_money,FORMAT(order_amount/100,2) as order_amount,discount,store_id,coupon_type,is_overlay,start_time,end_time,ids,gift_coupon_id,gift_goods_ids'; protected $availCartStoreIndexField = 'id,type,FORMAT(cash_money/100,2) as cash_money,FORMAT(order_amount/100,2) as order_amount,discount,store_id,coupon_type,is_overlay,start_time,end_time,ids,gift_coupon_id,gift_goods_ids';
public function init(){ public function init(){
...@@ -149,7 +150,7 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -149,7 +150,7 @@ class CouponModel extends \DAO\AbstractModel {
* @throws \Our\Exception * @throws \Our\Exception
*/ */
public function getStorePromotionCouponList($storeId){ public function getStorePromotionCouponList($storeId){
$field = $this->availStoreIndexField; $field = $this->availTitleField;
$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);
...@@ -166,22 +167,20 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -166,22 +167,20 @@ class CouponModel extends \DAO\AbstractModel {
if($storeClasses){ if($storeClasses){
$storeClassIds = array_column($storeClasses,'gc_id'); $storeClassIds = array_column($storeClasses,'gc_id');
} }
$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)){ if(!($coupon['start_time']<=TIMESTAMP&&$coupon['end_time']>TIMESTAMP)){
continue; continue;
} }
if($coupon['type']==\Our\ApiConst::goodsClassCoupon){ //指定品类优惠券,需要判断该优惠券对应分类店铺是否在经营 if($coupon['type']==\Our\ApiConst::goodsClassCoupon){ //指定品类优惠券,需要判断该优惠券对应分类店铺是否在经营
if($storeClassIds){ if($storeClassIds&&$coupon['ids']){
$gcIds = $storeCouponGoodsClassDao->getGoodsClassIdsByCouponId($coupon['id']); $gcIds = explode(',',trim($coupon['ids'],','));
if(!$gcIds){
continue;
}
$gcIdList = array_intersect($storeClassIds,$gcIds); $gcIdList = array_intersect($storeClassIds,$gcIds);
if(!$gcIdList){ if(count($gcIdList)!=count($gcIds)){
continue; continue;
} }
}else{
continue;
} }
} }
$temp = array(); $temp = 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