Authored by 毕凯

完善日韩馆

@@ -11,11 +11,13 @@ class ChannelController extends AbstractAction @@ -11,11 +11,13 @@ class ChannelController extends AbstractAction
11 */ 11 */
12 public function indexAction() 12 public function indexAction()
13 { 13 {
  14 + $title = $this->get('title', '');
  15 + $contentCode = $this->get('content_code', '');
14 // 设置网站标题 16 // 设置网站标题
15 - $this->setTitle('日韩馆'); // 需求是标题可以自定义  
16 - $this->setNavHeader('日韩馆', true, false); // 需求是标题可以自定义 17 + $this->setTitle($title);
  18 + $this->setNavHeader($title, true, true);
17 19
18 - $content = ChannelModel::getChannelFloor(); 20 + $content = ChannelModel::getChannelFloor($contentCode);
19 21
20 // 渲染模板并输出 22 // 渲染模板并输出
21 $this->_view->display('index', array( 23 $this->_view->display('index', array(
@@ -19,16 +19,17 @@ use Configs\CacheConfig; @@ -19,16 +19,17 @@ use Configs\CacheConfig;
19 class ChannelModel 19 class ChannelModel
20 { 20 {
21 21
22 - const CODE_FLOOR_JCSHOP = 'cdcc581da92a13c74e3bf1826f1806d1'; 22 + const CHANNEl_CODE = 'cdcc581da92a13c74e3bf1826f1806d1';
23 23
24 /** 24 /**
25 * 获取男生首页的楼层数据 25 * 获取男生首页的楼层数据
26 * 26 *
27 * @return array | false 27 * @return array | false
28 */ 28 */
29 - public static function getChannelFloor() 29 + public static function getChannelFloor($contentCode)
30 { 30 {
31 $result = array(); 31 $result = array();
  32 + $contentCode = !empty($contentCode) ? $contentCode : self::CHANNEl_CODE;
32 33
33 if (USE_CACHE) { 34 if (USE_CACHE) {
34 // 先尝试获取一级缓存(master), 有数据则直接返回. 35 // 先尝试获取一级缓存(master), 有数据则直接返回.
@@ -39,7 +40,7 @@ class ChannelModel @@ -39,7 +40,7 @@ class ChannelModel
39 } 40 }
40 41
41 // 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式 42 // 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式
42 - $channelData = ChannelData::getChannelData(self::CODE_FLOOR_JCSHOP); 43 + $channelData = ChannelData::getChannelData($contentCode);
43 44
44 if (isset($channelData['code']) && $channelData['code'] == 200) { 45 if (isset($channelData['code']) && $channelData['code'] == 200) {
45 $channelData = array( 46 $channelData = array(
@@ -61,4 +62,4 @@ class ChannelModel @@ -61,4 +62,4 @@ class ChannelModel
61 62
62 return $result; 63 return $result;
63 } 64 }
64 -}  
  65 +}