Authored by hf

fixes bug to home page

@@ -9,7 +9,9 @@ use Plugin\Helpers; @@ -9,7 +9,9 @@ use Plugin\Helpers;
9 */ 9 */
10 class FloorProcess 10 class FloorProcess
11 { 11 {
  12 +
12 private static $guangUrl = 'http://guang.m.yohobuy.com'; 13 private static $guangUrl = 'http://guang.m.yohobuy.com';
  14 +
13 /** 15 /**
14 * 频道参数 16 * 频道参数
15 * 17 *
@@ -151,7 +153,7 @@ class FloorProcess @@ -151,7 +153,7 @@ class FloorProcess
151 $build['textCn'] = $one['title']; 153 $build['textCn'] = $one['title'];
152 $result['hotCategory']['list'][] = $build; 154 $result['hotCategory']['list'][] = $build;
153 } 155 }
154 - 156 +
155 if (isset($data['title']['more_url'])) { 157 if (isset($data['title']['more_url'])) {
156 $data['title']['more_url'] = Helpers::getFilterUrl($data['title']['more_url']); 158 $data['title']['more_url'] = Helpers::getFilterUrl($data['title']['more_url']);
157 } 159 }
@@ -181,8 +183,8 @@ class FloorProcess @@ -181,8 +183,8 @@ class FloorProcess
181 $data['is_show_name'] = $data['title']['is_show']; 183 $data['is_show_name'] = $data['title']['is_show'];
182 $data['name'] = $data['title']['title']; 184 $data['name'] = $data['title']['title'];
183 unset($data['title']); 185 unset($data['title']);
184 -  
185 - if (isset($data['title']['more_url'])) { 186 +
  187 + if (isset($data['title']['more_url'])) {
186 $data['title']['more_url'] = Helpers::getFilterUrl($data['title']['more_url']); 188 $data['title']['more_url'] = Helpers::getFilterUrl($data['title']['more_url']);
187 } 189 }
188 190
@@ -227,12 +229,12 @@ class FloorProcess @@ -227,12 +229,12 @@ class FloorProcess
227 { 229 {
228 $result = array(); 230 $result = array();
229 231
230 - foreach($data as $key=>&$value){  
231 - if($key == 'title'){ 232 + foreach ($data as $key => &$value) {
  233 + if ($key == 'title') {
232 $value['more_url'] = Helpers::url('', array('id' => 3, 'gender' => self::$channel[$type]), 'guang'); 234 $value['more_url'] = Helpers::url('', array('id' => 3, 'gender' => self::$channel[$type]), 'guang');
233 } 235 }
234 - if($key == 'article'){  
235 - foreach($value as &$one){ 236 + if ($key == 'article') {
  237 + foreach ($value as &$one) {
236 if (isset($one['url'])) { 238 if (isset($one['url'])) {
237 $one['url'] = Helpers::getFilterUrl($one['url']); 239 $one['url'] = Helpers::getFilterUrl($one['url']);
238 } 240 }
@@ -240,8 +242,8 @@ class FloorProcess @@ -240,8 +242,8 @@ class FloorProcess
240 unset($one['src']); 242 unset($one['src']);
241 } 243 }
242 } 244 }
243 - if($key == 'recommend_collocation'){  
244 - foreach($value as &$one){ 245 + if ($key == 'recommend_collocation') {
  246 + foreach ($value as &$one) {
245 if (isset($one['url'])) { 247 if (isset($one['url'])) {
246 $one['url'] = Helpers::getFilterUrl($one['url']); 248 $one['url'] = Helpers::getFilterUrl($one['url']);
247 } 249 }
@@ -265,11 +267,11 @@ class FloorProcess @@ -265,11 +267,11 @@ class FloorProcess
265 { 267 {
266 $result = array(); 268 $result = array();
267 269
268 - foreach($data as $key=>&$value){  
269 - if($key == 'title'){ 270 + foreach ($data as $key => &$value) {
  271 + if ($key == 'title') {
270 $value['more_url'] = Helpers::url('', array('id' => 4, 'gender' => self::$channel[$type]), 'guang'); 272 $value['more_url'] = Helpers::url('', array('id' => 4, 'gender' => self::$channel[$type]), 'guang');
271 } 273 }
272 - if($key == 'list'){ 274 + if ($key == 'list') {
273 foreach ($value as &$one) { 275 foreach ($value as &$one) {
274 if (isset($one['url'])) { 276 if (isset($one['url'])) {
275 $one['url'] = Helpers::getFilterUrl($one['url']); 277 $one['url'] = Helpers::getFilterUrl($one['url']);
@@ -316,8 +318,8 @@ class FloorProcess @@ -316,8 +318,8 @@ class FloorProcess
316 318
317 unset($one['src']); 319 unset($one['src']);
318 } 320 }
319 -  
320 - if (isset($data['title']['more_url'])) { 321 +
  322 + if (isset($data['title']['more_url'])) {
321 $data['title']['more_url'] = Helpers::getFilterUrl($data['title']['more_url']); 323 $data['title']['more_url'] = Helpers::getFilterUrl($data['title']['more_url']);
322 } 324 }
323 325
@@ -355,8 +357,8 @@ class FloorProcess @@ -355,8 +357,8 @@ class FloorProcess
355 $one['img'] = Helpers::getImageUrl($one['src'], 191, 191); 357 $one['img'] = Helpers::getImageUrl($one['src'], 191, 191);
356 unset($one['src']); 358 unset($one['src']);
357 } 359 }
358 -  
359 - if (isset($data['title']['more_url'])) { 360 +
  361 + if (isset($data['title']['more_url'])) {
360 $data['title']['more_url'] = Helpers::getFilterUrl($data['title']['more_url']); 362 $data['title']['more_url'] = Helpers::getFilterUrl($data['title']['more_url']);
361 } 363 }
362 $result['creativeLife'] = $data; 364 $result['creativeLife'] = $data;
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="brand-page yoho-page"> 2 <div class="brand-page yoho-page">
3 -  
4 - <div class="newbrand-search">  
5 - <div class="search-box clearfix">  
6 - <a href="/index/search/index" >  
7 - <input type="text" class="search-input" placeholder="查找品牌">  
8 - <i class="search-icon iconfont">&#xe60f;</i>  
9 - </a>  
10 - </div>  
11 - </div>  
12 - 3 + <div class="newbrand-search">
  4 + <div class="search-box clearfix">
  5 + <a href="{{searchUrl}}" >
  6 + <input type="text" class="search-input" placeholder="查找品牌">
  7 + <i class="search-icon iconfont">&#xe60f;</i>
  8 + </a>
  9 + </div>
  10 + </div>
13 11
14 - {{# bannerTop}}  
15 - {{> home/banner_top}}  
16 - {{/ bannerTop}} 12 + {{# bannerTop}}
  13 + {{> home/banner_top}}
  14 + {{/ bannerTop}}
17 15
18 - {{# hotBrand}}  
19 - <div class="hot-brand"> 16 + {{# hotBrand}}
  17 + <div class="hot-brand">
20 <ul class="hot-brand-list clearfix"> 18 <ul class="hot-brand-list clearfix">
21 {{# list}} 19 {{# list}}
22 <li> 20 <li>
@@ -28,58 +26,58 @@ @@ -28,58 +26,58 @@
28 </li> 26 </li>
29 {{/ list}} 27 {{/ list}}
30 </ul> 28 </ul>
31 - </div>  
32 - {{/ hotBrand}} 29 + </div>
  30 + {{/ hotBrand}}
33 31
34 - {{# brandList}}  
35 - <div class="brand-list bar-{{@index}}">  
36 - <div class="title-bar">  
37 - <h2 style="position: static;">{{title}}</h2>  
38 - </div>  
39 - {{# list}}  
40 - <p>  
41 - <a href="{{url}}">{{name}}  
42 - {{# isHot}}  
43 - <i class="icon-hot">Hot</i>  
44 - {{/ isHot}}  
45 - {{# isNew}}  
46 - <i class="icon-new">New</i>  
47 - {{/ isNew}}  
48 - </a>  
49 - </p>  
50 - {{/ list}}  
51 - </div>  
52 - {{/ brandList}} 32 + {{# brandList}}
  33 + <div class="brand-list bar-{{@index}}">
  34 + <div class="title-bar">
  35 + <h2 style="position: static;">{{title}}</h2>
  36 + </div>
  37 + {{# list}}
  38 + <p>
  39 + <a href="{{url}}">{{name}}
  40 + {{# isHot}}
  41 + <i class="icon-hot">Hot</i>
  42 + {{/ isHot}}
  43 + {{# isNew}}
  44 + <i class="icon-new">New</i>
  45 + {{/ isNew}}
  46 + </a>
  47 + </p>
  48 + {{/ list}}
  49 + </div>
  50 + {{/ brandList}}
53 51
54 - <div id="right-bar" class="right-bar"> 52 + <div id="right-bar" class="right-bar">
55 <div class="con" id="con"> 53 <div class="con" id="con">
56 - <b>#</b>  
57 - <b>A</b>  
58 - <b>B</b>  
59 - <b>C</b>  
60 - <b>D</b>  
61 - <b>E</b>  
62 - <b>F</b>  
63 - <b>G</b>  
64 - <b>H</b>  
65 - <b>I</b>  
66 - <b>J</b>  
67 - <b>K</b>  
68 - <b>L</b>  
69 - <b>M</b>  
70 - <b>N</b>  
71 - <b>O</b>  
72 - <b>P</b>  
73 - <b>Q</b>  
74 - <b>R</b>  
75 - <b>S</b>  
76 - <b>T</b>  
77 - <b>U</b>  
78 - <b>V</b>  
79 - <b>W</b>  
80 - <b>X</b>  
81 - <b>Y</b>  
82 - <b>Z</b> 54 + <b>#</b>
  55 + <b>A</b>
  56 + <b>B</b>
  57 + <b>C</b>
  58 + <b>D</b>
  59 + <b>E</b>
  60 + <b>F</b>
  61 + <b>G</b>
  62 + <b>H</b>
  63 + <b>I</b>
  64 + <b>J</b>
  65 + <b>K</b>
  66 + <b>L</b>
  67 + <b>M</b>
  68 + <b>N</b>
  69 + <b>O</b>
  70 + <b>P</b>
  71 + <b>Q</b>
  72 + <b>R</b>
  73 + <b>S</b>
  74 + <b>T</b>
  75 + <b>U</b>
  76 + <b>V</b>
  77 + <b>W</b>
  78 + <b>X</b>
  79 + <b>Y</b>
  80 + <b>Z</b>
83 </div> 81 </div>
84 </div> 82 </div>
85 </div> 83 </div>
1 -{{>layout/header}} 1 +{{> layout/header}}
2 <div class="index-page yoho-page"> 2 <div class="index-page yoho-page">
3 <div class="index-container"> 3 <div class="index-container">
4 <div class="index-header clearfix"> 4 <div class="index-header clearfix">
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 <form action="{{searchUrl}}" class="index-search"> 6 <form action="{{searchUrl}}" class="index-search">
7 <a href="javascript:void(0);" class="no-search">取消</a> 7 <a href="javascript:void(0);" class="no-search">取消</a>
8 <div class="search-box"> 8 <div class="search-box">
  9 + <input type="hidden" name="from" value="search">
9 <input type="text" name="query" placeholder="搜索"> 10 <input type="text" name="query" placeholder="搜索">
10 <span class="iconfont clear-text">&#xe623;</span> 11 <span class="iconfont clear-text">&#xe623;</span>
11 <span class="iconfont search-icon">&#xe60f;</span> 12 <span class="iconfont search-icon">&#xe60f;</span>
@@ -23,5 +24,5 @@ @@ -23,5 +24,5 @@
23 </div> 24 </div>
24 </div> 25 </div>
25 </div> 26 </div>
26 -{{>layout/footer}} 27 +{{> layout/footer}}
27 {{> layout/download_app}} 28 {{> layout/download_app}}
@@ -28,7 +28,8 @@ class BoysController extends AbstractAction @@ -28,7 +28,8 @@ class BoysController extends AbstractAction
28 'boysHomePage' => true, 28 'boysHomePage' => true,
29 'showFooterTab'=>true, 29 'showFooterTab'=>true,
30 'maybeLike' => true, 30 'maybeLike' => true,
31 - 'content' => Index\HomeModel::getBoysFloor() 31 + 'content' => Index\HomeModel::getBoysFloor(),
  32 + 'pageFooter' => true,
32 )); 33 ));
33 34
34 } 35 }
@@ -28,7 +28,8 @@ class GirlsController extends AbstractAction @@ -28,7 +28,8 @@ class GirlsController extends AbstractAction
28 'grilsHomePage' => true, 28 'grilsHomePage' => true,
29 'showFooterTab'=>true, 29 'showFooterTab'=>true,
30 'maybeLike' => true, 30 'maybeLike' => true,
31 - 'content' => Index\HomeModel::getGirlsFloor() 31 + 'content' => Index\HomeModel::getGirlsFloor(),
  32 + 'pageFooter' => true,
32 )); 33 ));
33 } 34 }
34 35
@@ -23,6 +23,7 @@ class IndexController extends AbstractAction @@ -23,6 +23,7 @@ class IndexController extends AbstractAction
23 'channelPage' => true, 23 'channelPage' => true,
24 'showDownloadApp'=>true, 24 'showDownloadApp'=>true,
25 'searchUrl' => Helpers::url('', null, 'search'), 25 'searchUrl' => Helpers::url('', null, 'search'),
  26 + 'pageFooter' => true,
26 )); 27 ));
27 } 28 }
28 29
@@ -28,7 +28,8 @@ class KidsController extends AbstractAction @@ -28,7 +28,8 @@ class KidsController extends AbstractAction
28 'kidsHomePage' => true, 28 'kidsHomePage' => true,
29 'showFooterTab'=>true, 29 'showFooterTab'=>true,
30 'maybeLike' => true, 30 'maybeLike' => true,
31 - 'content' => Index\HomeModel::getKidsFloor() 31 + 'content' => Index\HomeModel::getKidsFloor(),
  32 + 'pageFooter' => true,
32 )); 33 ));
33 } 34 }
34 35
@@ -28,7 +28,8 @@ class LifestyleController extends AbstractAction @@ -28,7 +28,8 @@ class LifestyleController extends AbstractAction
28 'lifestyleHomePage' => true, 28 'lifestyleHomePage' => true,
29 'showFooterTab'=>true, 29 'showFooterTab'=>true,
30 'maybeLike' => true, 30 'maybeLike' => true,
31 - 'content' => Index\HomeModel::getLifestyleFloor() 31 + 'content' => Index\HomeModel::getLifestyleFloor(),
  32 + 'pageFooter' => true,
32 )); 33 ));
33 } 34 }
34 35
@@ -44,7 +44,7 @@ class SearchController extends AbstractAction @@ -44,7 +44,7 @@ class SearchController extends AbstractAction
44 'gender' => FILTER_DEFAULT, 44 'gender' => FILTER_DEFAULT,
45 'p_d' => FILTER_DEFAULT,), false); 45 'p_d' => FILTER_DEFAULT,), false);
46 46
47 - $query = isset($condition['query']) ? strtolower(trim($condition['query'])) : null; 47 + $query = empty($condition['query']) ? null : strtolower(trim($condition['query']));
48 if (isset($condition['discount'])) { 48 if (isset($condition['discount'])) {
49 $condition['p_d'] = rawurldecode($condition['discount']); 49 $condition['p_d'] = rawurldecode($condition['discount']);
50 unset($condition['discount']); 50 unset($condition['discount']);
@@ -90,16 +90,15 @@ class SearchController extends AbstractAction @@ -90,16 +90,15 @@ class SearchController extends AbstractAction
90 90
91 // 跳转到品牌商品列表页 91 // 跳转到品牌商品列表页
92 if ($domain !== null) { 92 if ($domain !== null) {
93 - $url = Helpers::url('', array(  
94 - 'from' => 'search',  
95 - 'query' => $query,  
96 - 'gender' => $condition['gender']  
97 - ), $domain); 93 + $url = Helpers::url('', array(
  94 + 'from' => 'search',
  95 + 'query' => $query,
  96 + 'gender' => $condition['gender']
  97 + ), $domain);
98 $this->go($url); 98 $this->go($url);
99 } 99 }
100 } 100 }
101 101
102 -  
103 /* 判断是不是品类, 是品类加导航标题(不显示搜索框) */ 102 /* 判断是不是品类, 是品类加导航标题(不显示搜索框) */
104 if ($haveQuery) { 103 if ($haveQuery) {
105 $classNames = Category\ClassModel::getClassNames(); 104 $classNames = Category\ClassModel::getClassNames();
@@ -148,25 +147,25 @@ class SearchController extends AbstractAction @@ -148,25 +147,25 @@ class SearchController extends AbstractAction
148 $data['goodList'] = $condition; 147 $data['goodList'] = $condition;
149 $data['query'] = $query; 148 $data['query'] = $query;
150 149
151 - // 查询数据  
152 - if (!isset($condition['query'])) {  
153 - $data['goodList'] += Product\ListModel::getClassData($condition);  
154 - } else {  
155 - $listData = SearchData::searchByCondition($condition);  
156 - // 处理返回的数据  
157 - if (!empty($listData['data']['brand'])) {  
158 - $brandData = $listData['data']['brand'];  
159 - $data['brandWay'] = array(  
160 - 'url' => 'http://' . $brandData['brand_domain'] . SUB_DOMAIN,  
161 - 'thumb' => Helpers::getImageUrl($brandData['brand_ico'], 75, 40),  
162 - 'name' => $brandData['brand_name']  
163 - );  
164 - // 设置品牌默认值  
165 - $data['goodList']['brand'] = $brandData['id'];  
166 - $data['goodList'] += ListProcess::getListData($listData['data']);  
167 - }  
168 - $listData = array();  
169 - } 150 +// // 查询数据
  151 +// if (!isset($condition['query'])) {
  152 +// $data['goodList'] += Product\ListModel::getClassData($condition);
  153 +// } else {
  154 +// $listData = SearchData::searchByCondition($condition);
  155 +// // 处理返回的数据
  156 +// if (!empty($listData['data']['brand'])) {
  157 +// $brandData = $listData['data']['brand'];
  158 +// $data['brandWay'] = array(
  159 +// 'url' => 'http://' . $brandData['brand_domain'] . SUB_DOMAIN,
  160 +// 'thumb' => Helpers::getImageUrl($brandData['brand_ico'], 75, 40),
  161 +// 'name' => $brandData['brand_name']
  162 +// );
  163 +// // 设置品牌默认值
  164 +// $data['goodList']['brand'] = $brandData['id'];
  165 +// $data['goodList'] += ListProcess::getListData($listData['data']);
  166 +// }
  167 +// $listData = array();
  168 +// }
170 169
171 $this->_view->display('list', $data); 170 $this->_view->display('list', $data);
172 } 171 }
@@ -57,6 +57,8 @@ class BrandModel @@ -57,6 +57,8 @@ class BrandModel
57 $result['brandPage'] = true; 57 $result['brandPage'] = true;
58 // 是否显示app下载浮层标识 58 // 是否显示app下载浮层标识
59 $result['showDownloadApp'] = true; 59 $result['showDownloadApp'] = true;
  60 + // 搜索链接地址
  61 + $result['searchUrl'] = Helpers::url('/search.html', null, 'search');
60 62
61 /* 顶部的轮翻广告列表 */ 63 /* 顶部的轮翻广告列表 */
62 if (!empty($brand['brandTop'][0]['data'])) { 64 if (!empty($brand['brandTop'][0]['data'])) {
@@ -138,7 +138,6 @@ class IndexModel @@ -138,7 +138,6 @@ class IndexModel
138 $build['type'] = $value['name']; 138 $build['type'] = $value['name'];
139 $build['focus'] = ($value['id'] == $type); 139 $build['focus'] = ($value['id'] == $type);
140 $data['navs'][] = $build; 140 $data['navs'][] = $build;
141 -  
142 $data['guang']['infos'][] = array( 141 $data['guang']['infos'][] = array(
143 'show' => $build['focus'], 142 'show' => $build['focus'],
144 'info' => array(), 143 'info' => array(),
@@ -155,6 +154,19 @@ class IndexModel @@ -155,6 +154,19 @@ class IndexModel
155 $data['guang']['swiper'][] = $build; 154 $data['guang']['swiper'][] = $build;
156 } 155 }
157 } 156 }
  157 + // 只有当$type=0时才有广告参数返回, 所以需要再调一次!!
  158 + else {
  159 + $temp = ListData::article('1,3', 0, 0, '', $page);
  160 + if (!empty($temp['data']['list']['adlist'])) {
  161 + foreach ($temp['data']['list']['adlist'] as $value) {
  162 + $build = array();
  163 + $build['url'] = Helpers::getFilterUrl($value['url']);
  164 + $build['img'] = Helpers::getImageUrl($value['src'], 830, 327);
  165 + $data['guang']['swiper'][] = $build;
  166 + }
  167 + }
  168 + $temp = array();
  169 + }
158 170
159 // 内容列表 171 // 内容列表
160 if (!empty($article['data']['list']['artList'])) { 172 if (!empty($article['data']['list']['artList'])) {
@@ -168,7 +168,7 @@ class HomeModel @@ -168,7 +168,7 @@ class HomeModel
168 // 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式 168 // 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式
169 $channelData = IndexData::getResourceData('2,3', self::CODE_FLOOR_GIRLS); 169 $channelData = IndexData::getResourceData('2,3', self::CODE_FLOOR_GIRLS);
170 if (isset($channelData['code']) && $channelData['code'] == 200) { 170 if (isset($channelData['code']) && $channelData['code'] == 200) {
171 - $result = FloorProcess::getContent($channelData['data']); 171 + $result = FloorProcess::getContent($channelData['data'], 2);
172 } 172 }
173 173
174 if (USE_CACHE) { 174 if (USE_CACHE) {