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 *
@@ -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']);
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"> 3 <div class="newbrand-search">
5 <div class="search-box clearfix"> 4 <div class="search-box clearfix">
6 - <a href="/index/search/index" > 5 + <a href="{{searchUrl}}" >
7 <input type="text" class="search-input" placeholder="查找品牌"> 6 <input type="text" class="search-input" placeholder="查找品牌">
8 <i class="search-icon iconfont">&#xe60f;</i> 7 <i class="search-icon iconfont">&#xe60f;</i>
9 </a> 8 </a>
10 </div> 9 </div>
11 </div> 10 </div>
12 11
13 -  
14 {{# bannerTop}} 12 {{# bannerTop}}
15 {{> home/banner_top}} 13 {{> home/banner_top}}
16 {{/ bannerTop}} 14 {{/ bannerTop}}
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']);
@@ -99,7 +99,6 @@ class SearchController extends AbstractAction @@ -99,7 +99,6 @@ class SearchController extends AbstractAction
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) {