...
|
...
|
@@ -45,6 +45,11 @@ class HomeModel |
|
|
/* COOKIE标识访问的是创意生活频道 */
|
|
|
const COOKIE_NAME_LIFESTYLE = 'lifestyle';
|
|
|
|
|
|
/* COOKIE标识访问的是男生频道底部Banner */
|
|
|
const COOKIE_NAME_BOYS_BOTTOM_BANNER = '8c48745a39373d621bf5fd80edf59b5e';
|
|
|
/* COOKIE标识访问的是女生频道频道底部Banner */
|
|
|
const COOKIE_NAME_GIRLS_BOTTOM_BANNER = 'c63939b2ad458e9cb51147940c1da2e5';
|
|
|
|
|
|
/**
|
|
|
* 选择频道
|
|
|
*
|
...
|
...
|
@@ -112,6 +117,56 @@ class HomeModel |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取男生,女生底部banner
|
|
|
*
|
|
|
* @return string | false
|
|
|
*/
|
|
|
public static function getBottomBanner($channel)
|
|
|
{
|
|
|
$result = false;
|
|
|
if($channel == 2) {
|
|
|
$resource = self::COOKIE_NAME_GIRLS_BOTTOM_BANNER;
|
|
|
$cache = CacheConfig::KEY_ACTION_GRILS_BOTTOM_BANNER;
|
|
|
} else {
|
|
|
$resource = self::COOKIE_NAME_BOYS_BOTTOM_BANNER;
|
|
|
$cache = CacheConfig::KEY_ACTION_BOYS_BOTTOM_BANNER;
|
|
|
}
|
|
|
|
|
|
if (USE_CACHE) {
|
|
|
// 先尝试获取一级缓存(master), 有数据则直接返回.
|
|
|
$result = Cache::get($cache, 'master');
|
|
|
if (!empty($result)) {
|
|
|
return $result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 调用接口获取数据
|
|
|
$banner = IndexData::getBannerStart($resource);
|
|
|
if (isset($banner['code']) && $banner['code'] == 200) {
|
|
|
// 构建数据
|
|
|
$data = array();
|
|
|
foreach ($banner['data'] as $val) {
|
|
|
$data['list'][] = $val;
|
|
|
}
|
|
|
|
|
|
$result = FloorProcess::getContent($data, $channel);
|
|
|
}
|
|
|
|
|
|
if (USE_CACHE) {
|
|
|
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
|
|
|
if (empty($result)) {
|
|
|
$result = Cache::get($cache, 'slave');
|
|
|
}
|
|
|
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
|
|
|
else {
|
|
|
Cache::set($cache, $result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取男生首页的楼层数据
|
|
|
*
|
|
|
* @return array | false
|
...
|
...
|
|