Commit a4afcd05 authored by liuyuzhen's avatar liuyuzhen

优惠券有效数据

parent b7cbd8c5
...@@ -168,6 +168,7 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -168,6 +168,7 @@ class CouponModel extends \DAO\AbstractModel {
$storeClassIds = array_column($storeClasses,'gc_id'); $storeClassIds = array_column($storeClasses,'gc_id');
} }
$result = array(); $result = array();
$goodsCommonDao = \DAO\GoodsCommonModel::getInstance();
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;
...@@ -183,6 +184,22 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -183,6 +184,22 @@ class CouponModel extends \DAO\AbstractModel {
continue; continue;
} }
} }
if($coupon['type']==\Our\ApiConst::goodsCoupon){ //指定商品优惠券,判断商品是否在线,在线才能展示
$goodsCommmonIds = array_filter(explode(',',$coupon['gift_goods_commonids']));
if(!$goodsCommmonIds){
continue;
}
$goodsCon = array();
$goodsCon['goods_commonid'] = array('in',$goodsCommmonIds);
$goodsCon['goods_state'] = \Our\ApiConst::onlineGoodsState;
$goodsCon['goods_verify'] = \Our\ApiConst::onlineGoodsVerify;
$goodsCon['is_del'] = \Our\ApiConst::onlineGoodsDel;
//$goodsCommonFlag = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(), array(&$goodsCommonDao, 'getOne'),array($goodsCon,'goods_commonid'),\Our\ApiConst::oneHour);
$goodsCommonFlag = $goodsCommonDao->getOne($goodsCon,'goods_commonid');
if(!$goodsCommonFlag){
continue;
}
}
$temp = array(); $temp = array();
$temp['couponId'] = $coupon['id']; $temp['couponId'] = $coupon['id'];
$orderAmount = intval($coupon['order_amount']); $orderAmount = intval($coupon['order_amount']);
......
...@@ -32,8 +32,13 @@ class GoodsCommonModel extends \DAO\AbstractModel { ...@@ -32,8 +32,13 @@ class GoodsCommonModel extends \DAO\AbstractModel {
public function getOne($where,$field = \Our\NameConst::allField){ public function getOne($where,$field = \Our\NameConst::allField){
$this->setDb($this->dbName); $this->setDb($this->dbName);
if(is_array($where)){
$where = $this->db->getSqlWhereByArray($where);
}
return $this->db->select($field)->from($this->_tableName)->where($where)->fetchOne(); return $this->db->select($field)->from($this->_tableName)->where($where)->fetchOne();
} }
public function getGoodsSaleNumFromCache($goodsCommonId){ public function getGoodsSaleNumFromCache($goodsCommonId){
$goodsCommonRedis = \Redis\Db4\GoodsCommonRedisModel::getInstance(); $goodsCommonRedis = \Redis\Db4\GoodsCommonRedisModel::getInstance();
$onlineGoodsCommonSaleNumKey = \Our\NameConst::onlineGoodsCommonSaleNumPrefix; $onlineGoodsCommonSaleNumKey = \Our\NameConst::onlineGoodsCommonSaleNumPrefix;
......
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