Authored by 毕凯

完善日韩馆

... ... @@ -11,11 +11,13 @@ class ChannelController extends AbstractAction
*/
public function indexAction()
{
$title = $this->get('title', '');
$contentCode = $this->get('content_code', '');
// 设置网站标题
$this->setTitle('日韩馆'); // 需求是标题可以自定义
$this->setNavHeader('日韩馆', true, false); // 需求是标题可以自定义
$this->setTitle($title);
$this->setNavHeader($title, true, true);
$content = ChannelModel::getChannelFloor();
$content = ChannelModel::getChannelFloor($contentCode);
// 渲染模板并输出
$this->_view->display('index', array(
... ...
... ... @@ -19,16 +19,17 @@ use Configs\CacheConfig;
class ChannelModel
{
const CODE_FLOOR_JCSHOP = 'cdcc581da92a13c74e3bf1826f1806d1';
const CHANNEl_CODE = 'cdcc581da92a13c74e3bf1826f1806d1';
/**
* 获取男生首页的楼层数据
*
* @return array | false
*/
public static function getChannelFloor()
public static function getChannelFloor($contentCode)
{
$result = array();
$contentCode = !empty($contentCode) ? $contentCode : self::CHANNEl_CODE;
if (USE_CACHE) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
... ... @@ -39,7 +40,7 @@ class ChannelModel
}
// 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式
$channelData = ChannelData::getChannelData(self::CODE_FLOOR_JCSHOP);
$channelData = ChannelData::getChannelData($contentCode);
if (isset($channelData['code']) && $channelData['code'] == 200) {
$channelData = array(
... ... @@ -61,4 +62,4 @@ class ChannelModel
return $result;
}
}
\ No newline at end of file
}
... ...