Commit ef0e510b authored by liuyuzhen's avatar liuyuzhen

店铺中部广告位

parent 6f9c8c46
...@@ -147,17 +147,19 @@ class AdvServiceModel extends \Business\AbstractModel{ ...@@ -147,17 +147,19 @@ class AdvServiceModel extends \Business\AbstractModel{
public function getStoreAdvs($where,$position){ public function getStoreAdvs($where,$position){
$advMobileDao = \DAO\Adv\AdvMobileModel::getInstance(); $advMobileDao = \DAO\Adv\AdvMobileModel::getInstance();
$advMobileSql = "store_id = {0} and position = {1} and state ={2} and start_time < {3} and end_time >= {4} and is_use = {5}"; $advMobileSql = "store_id = {0} and position = {1} and state ={2} and is_use = {3}";
$advMobileSql = \Our\Common::format($advMobileSql,$where['storeId'],$position,\Our\ApiConst::one,time(),time(),\Our\ApiConst::one); $advMobileSql = \Our\Common::format($advMobileSql,$where['storeId'],$position,\Our\ApiConst::one,\Our\ApiConst::one);
$advMobileField = 'href,src'; $advMobileField = 'href,src,end_time,start_time';
$advMobileList = $advMobileDao->getList($advMobileSql,$advMobileField,array('adv_id'=>\Our\NameConst::desc)); $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']));
if($advMobileList){ if($advMobileList){
$advs = array(); $advs = array();
foreach($advMobileList as $adv){ foreach($advMobileList as $adv){
$temp = array(); if($adv['start_time']<=TIMESTAMP&&$adv['end_time']>TIMESTAMP){
$temp['imageUrl'] = \Our\Common::getStaticFile($adv['src'],\Our\ImageConst::advSrcImagePath); $temp = array();
$temp['href'] = $adv['href']; $temp['imageUrl'] = \Our\Common::getStaticFile($adv['src'],\Our\ImageConst::advSrcImagePath);
$advs[] = $temp; $temp['href'] = $adv['href'];
$advs[] = $temp;
}
} }
}else{ }else{
$storeAdvPositionDao = \DAO\Adv\StoreAdvPositionModel::getInstance(); $storeAdvPositionDao = \DAO\Adv\StoreAdvPositionModel::getInstance();
......
...@@ -542,7 +542,7 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -542,7 +542,7 @@ class StoreServiceModel extends \Business\AbstractModel{
\Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyGcId); \Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyGcId);
} }
//获取当前分类对应的全部店铺 //获取当前分类对应的全部店铺
$allStores = $this->getOnlineStoresByGcId($gcId); $allStores = $this->getOnlineStoresByGcId($gcId,$condition);
foreach($allStores as &$store){ foreach($allStores as &$store){
$store['isPurchased'] = \Our\ApiConst::zero; $store['isPurchased'] = \Our\ApiConst::zero;
} }
...@@ -553,7 +553,6 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -553,7 +553,6 @@ class StoreServiceModel extends \Business\AbstractModel{
//$storeMemberDao->getList(array('member_id'=>$memberId,'type'=>\Our\ApiConst::storeQrcodeMember),'distinct(store_id) as store_id') //$storeMemberDao->getList(array('member_id'=>$memberId,'type'=>\Our\ApiConst::storeQrcodeMember),'distinct(store_id) as store_id')
} }
$goodsClassDao = \DAO\GoodsClassModel::getInstance(); $goodsClassDao = \DAO\GoodsClassModel::getInstance();
//获取当前分类对应所有店铺信息 //获取当前分类对应所有店铺信息
......
...@@ -43,9 +43,14 @@ class AdvMobileModel extends \DAO\AbstractModel{ ...@@ -43,9 +43,14 @@ class AdvMobileModel extends \DAO\AbstractModel{
} }
} }
$result = $this->db->fetchAll(); $result = $this->db->fetchAll();
echo $this->db->getLastSql();
return $result; return $result;
} }
public function deleteStoreAdvMobileCache($storeId){
\Our\RedisHelper::delCachedFunction(\Redis\Db9\AdvMobileRedisModel::getInstance(),array(&$this, 'getList'),array(),array($storeId));
}
public function delAdvMobile($store){ public function delAdvMobile($store){
$advRedis = \Redis\Db9\AdvRedisModel::getInstance(); $advRedis = \Redis\Db9\AdvRedisModel::getInstance();
$storeMiddleAdvsKey = \Our\NameConst::storeMiddleAdvsPrefix.$store; $storeMiddleAdvsKey = \Our\NameConst::storeMiddleAdvsPrefix.$store;
......
...@@ -33,6 +33,7 @@ class QmStoreClassModel extends \DAO\AbstractModel{ ...@@ -33,6 +33,7 @@ class QmStoreClassModel extends \DAO\AbstractModel{
}else{ }else{
$result = $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll(); $result = $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll();
} }
return $result; return $result;
} }
......
...@@ -200,6 +200,7 @@ class StoreModel extends \DAO\AbstractModel ...@@ -200,6 +200,7 @@ class StoreModel extends \DAO\AbstractModel
}else{ }else{
$result = $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll(); $result = $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll();
} }
echo $this->db->getLastSql();
return $result; return $result;
} }
......
<?php
namespace Redis\Db9;
/**
* User: liuyuzhen
* Date: 2018/8/30
* Time: 10:20
* Description:
*/
class AdvMobileRedisModel extends \Redis\Db9\AbstractModel {
/**
* 表名
*
* @var string
*/
protected $_tableName = 'han_adv_mobile';
/**
* 类实例
*
*/
private static $_instance = null;
/**
* 获取类实例
*/
public static function getInstance() {
if (!(self::$_instance instanceof self)) {
self::$_instance = new self();
}
return self::$_instance;
}
}
\ No newline at end of file
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