Authored by yangyang

完成频道选择页代码

... ... @@ -19,7 +19,6 @@ class IndexData {
{
$param = Yohobuy::param();
$param['client_secret'] = Sign::getSign($param);
print_r($param);
Yohobuy::post('http://service.api.yohobuy.com/operations/api/v5/entrance/getEntrance',$param);
return Yohobuy::get('http://service.api.yohobuy.com/operations/api/v5/entrance/getEntrance',$param);
}
}
... ...
<?php
use Action\AbstractAction;
use Index\IndexModel;
use Plugin\Helpers;
use LibModels\Wap\Index\IndexData;
/**
* 频道选择
... ... @@ -15,25 +15,25 @@ class IndexController extends AbstractAction
*/
public function indexAction()
{
// if (null !== $this->get('go')) {
// // 先检查COOKIE是否有访问过, 有则跳转到相应的频道页
// Index\HomeModel::goSwitchChannel();
// } else {
// // 设置客户端浏览器1小时内不改变,
// $this->setLastModified(mktime(date('H'), 0, 0, date('n'), date('j'), date('Y')));
// // 设置浏览器缓存5分钟
// $this->setExpires(300);
// }
var_dump(IndexData::channelData());
if (null !== $this->get('go')) {
// 先检查COOKIE是否有访问过, 有则跳转到相应的频道页
Index\HomeModel::goSwitchChannel();
} else {
// 设置客户端浏览器1小时内不改变,
$this->setLastModified(mktime(date('H'), 0, 0, date('n'), date('j'), date('Y')));
// 设置浏览器缓存5分钟
$this->setExpires(300);
}
$result = IndexModel::getChannel();
$result['background'] = Index\HomeModel::getBgImage();
$result['channelPage'] = true;
$result['showDownloadApp'] = true;
$result['searchUrl'] = Helpers::url('', null, 'search');
$result['pageFooter'] = true;
// 渲染模板
$this->_view->display('index', array(
'background' => Index\HomeModel::getBgImage(),
'channelPage' => true,
'showDownloadApp'=>true,
'searchUrl' => Helpers::url('', null, 'search'),
'pageFooter' => true,
));
$this->_view->display('index', $result);
}
/**
* 设置升级公告路由
*
... ...
<?php
namespace Index;
use LibModels\Wap\Index\IndexData;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of Index
*
* @author Administrator
*/
class IndexModel
{
public function getChannel(){
$result = array();
$result['showYohood'] = false;
$data = IndexData::channelData();
$channelList = array();
if($data['code'] == 200 && isset($data['data']['list'])){
foreach($data['data']['list'] as $key => $value){
switch ($value['channel_id']) {
case 5:
$result['showYohood'] = true;
break;
case 1:
$channelList[$key]['href'] = '/boys';
$channelList[$key]['title'] = '男生';
$channelList[$key]['entitle'] = 'BOYS';
break;
case 2:
$channelList[$key]['href'] = '/girls';
$channelList[$key]['title'] = '女生';
$channelList[$key]['entitle'] = 'GIRLS';
break;
case 3:
$channelList[$key]['href'] = '/kids';
$channelList[$key]['title'] = '潮童';
$channelList[$key]['entitle'] = 'KIDS';
break;
case 4:
$channelList[$key]['href'] = '/lifestyle';
$channelList[$key]['title'] = '创意生活';
$channelList[$key]['entitle'] = 'LIFESTYLE';
break;
default:
break;
}
}
$result['channelList'] = $channelList;
}
return $result;
}
}
... ...