Authored by yangyang

修改文件目录

... ... @@ -68,4 +68,16 @@ class IndexData
return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/home', $param);
}
/**
* 获取频道选择页数据
*
* @return array
*/
public static function channelData()
{
$param = Yohobuy::param();
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/entrance/getEntrance',$param,3600);
}
}
... ...
<?php
namespace LibModels\Wap\Index;
use Api\Sign;
use Api\Yohobuy;
/*
* 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 IndexChannel
*
* @author Administrator
*/
class IndexData {
public static function channelData()
{
$param = Yohobuy::param();
$param['client_secret'] = Sign::getSign($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;
/**
... ... @@ -24,7 +23,7 @@ class IndexController extends AbstractAction
// 设置浏览器缓存5分钟
$this->setExpires(300);
}
$result = IndexModel::getChannel();
$result = Index\HomeModel::getChannel();
$result['background'] = Index\HomeModel::getBgImage();
$result['channelPage'] = true;
$result['showDownloadApp'] = true;
... ...
... ... @@ -319,4 +319,53 @@ class HomeModel
return $result;
}
/**
* 获取频道选择页数据
*
* @return array
*/
public static 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;
$result['yohoodHref'] = '/yohood';
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;
}
}
... ...
<?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 static 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;
$result['yohoodHref'] = '/yohood';
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;
}
}