Authored by yangyang

修改文件目录

@@ -67,5 +67,17 @@ class IndexData @@ -67,5 +67,17 @@ class IndexData
67 67
68 return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/home', $param); 68 return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/home', $param);
69 } 69 }
  70 +
  71 + /**
  72 + * 获取频道选择页数据
  73 + *
  74 + * @return array
  75 + */
  76 + public static function channelData()
  77 + {
  78 + $param = Yohobuy::param();
  79 + $param['client_secret'] = Sign::getSign($param);
  80 + return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/entrance/getEntrance',$param,3600);
  81 + }
70 82
71 } 83 }
1 -<?php  
2 -namespace LibModels\Wap\Index;  
3 -  
4 -use Api\Sign;  
5 -use Api\Yohobuy;  
6 -/*  
7 - * To change this license header, choose License Headers in Project Properties.  
8 - * To change this template file, choose Tools | Templates  
9 - * and open the template in the editor.  
10 - */  
11 -  
12 -/**  
13 - * Description of IndexChannel  
14 - *  
15 - * @author Administrator  
16 - */  
17 -class IndexData {  
18 - public static function channelData()  
19 - {  
20 - $param = Yohobuy::param();  
21 - $param['client_secret'] = Sign::getSign($param);  
22 - return Yohobuy::get('http://service.api.yohobuy.com/operations/api/v5/entrance/getEntrance',$param);  
23 - }  
24 -}  
1 <?php 1 <?php
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
4 -use Index\IndexModel;  
5 use Plugin\Helpers; 4 use Plugin\Helpers;
6 5
7 /** 6 /**
@@ -24,7 +23,7 @@ class IndexController extends AbstractAction @@ -24,7 +23,7 @@ class IndexController extends AbstractAction
24 // 设置浏览器缓存5分钟 23 // 设置浏览器缓存5分钟
25 $this->setExpires(300); 24 $this->setExpires(300);
26 } 25 }
27 - $result = IndexModel::getChannel(); 26 + $result = Index\HomeModel::getChannel();
28 $result['background'] = Index\HomeModel::getBgImage(); 27 $result['background'] = Index\HomeModel::getBgImage();
29 $result['channelPage'] = true; 28 $result['channelPage'] = true;
30 $result['showDownloadApp'] = true; 29 $result['showDownloadApp'] = true;
@@ -318,5 +318,54 @@ class HomeModel @@ -318,5 +318,54 @@ class HomeModel
318 318
319 return $result; 319 return $result;
320 } 320 }
  321 +
  322 + /**
  323 + * 获取频道选择页数据
  324 + *
  325 + * @return array
  326 + */
  327 + public static function getChannel(){
  328 + $result = array();
  329 + $result['showYohood'] = false;
  330 +
  331 + $data = IndexData::channelData();
  332 +
  333 + $channelList = array();
  334 + if($data['code'] == 200 && isset($data['data']['list'])){
  335 + foreach($data['data']['list'] as $key => $value){
  336 + switch ($value['channel_id']) {
  337 + case 5:
  338 + $result['showYohood'] = true;
  339 + $result['yohoodHref'] = '/yohood';
  340 + break;
  341 + case 1:
  342 + $channelList[$key]['href'] = '/boys';
  343 + $channelList[$key]['title'] = '男生';
  344 + $channelList[$key]['entitle'] = 'BOYS';
  345 + break;
  346 + case 2:
  347 + $channelList[$key]['href'] = '/girls';
  348 + $channelList[$key]['title'] = '女生';
  349 + $channelList[$key]['entitle'] = 'GIRLS';
  350 + break;
  351 + case 3:
  352 + $channelList[$key]['href'] = '/kids';
  353 + $channelList[$key]['title'] = '潮童';
  354 + $channelList[$key]['entitle'] = 'KIDS';
  355 + break;
  356 + case 4:
  357 + $channelList[$key]['href'] = '/lifestyle';
  358 + $channelList[$key]['title'] = '创意生活';
  359 + $channelList[$key]['entitle'] = 'LIFESTYLE';
  360 + break;
  361 + default:
  362 + break;
  363 + }
  364 + }
  365 + $result['channelList'] = $channelList;
  366 + }
  367 +
  368 + return $result;
  369 + }
321 370
322 } 371 }
1 -<?php  
2 -namespace Index;  
3 -  
4 -use LibModels\Wap\Index\IndexData;  
5 -/*  
6 - * To change this license header, choose License Headers in Project Properties.  
7 - * To change this template file, choose Tools | Templates  
8 - * and open the template in the editor.  
9 - */  
10 -  
11 -/**  
12 - * Description of Index  
13 - *  
14 - * @author Administrator  
15 - */  
16 -class IndexModel  
17 -{  
18 - public static function getChannel(){  
19 - $result = array();  
20 - $result['showYohood'] = false;  
21 -  
22 - $data = IndexData::channelData();  
23 -  
24 - $channelList = array();  
25 - if($data['code'] == 200 && isset($data['data']['list'])){  
26 - foreach($data['data']['list'] as $key => $value){  
27 - switch ($value['channel_id']) {  
28 - case 5:  
29 - $result['showYohood'] = true;  
30 - $result['yohoodHref'] = '/yohood';  
31 - break;  
32 - case 1:  
33 - $channelList[$key]['href'] = '/boys';  
34 - $channelList[$key]['title'] = '男生';  
35 - $channelList[$key]['entitle'] = 'BOYS';  
36 - break;  
37 - case 2:  
38 - $channelList[$key]['href'] = '/girls';  
39 - $channelList[$key]['title'] = '女生';  
40 - $channelList[$key]['entitle'] = 'GIRLS';  
41 - break;  
42 - case 3:  
43 - $channelList[$key]['href'] = '/kids';  
44 - $channelList[$key]['title'] = '潮童';  
45 - $channelList[$key]['entitle'] = 'KIDS';  
46 - break;  
47 - case 4:  
48 - $channelList[$key]['href'] = '/lifestyle';  
49 - $channelList[$key]['title'] = '创意生活';  
50 - $channelList[$key]['entitle'] = 'LIFESTYLE';  
51 - break;  
52 - default:  
53 - break;  
54 - }  
55 - }  
56 - $result['channelList'] = $channelList;  
57 - }  
58 -  
59 - return $result;  
60 - }  
61 -  
62 -}