Authored by 梁志锋

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop

framework @ 75bbc3b0
1 -Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05 1 +Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
@@ -15,6 +15,7 @@ namespace Action; @@ -15,6 +15,7 @@ namespace Action;
15 use Yaf\Controller_Abstract; 15 use Yaf\Controller_Abstract;
16 use Yaf\Dispatcher; 16 use Yaf\Dispatcher;
17 use Plugin\Cache; 17 use Plugin\Cache;
  18 +use Plugin\Helpers;
18 19
19 class AbstractAction extends Controller_Abstract 20 class AbstractAction extends Controller_Abstract
20 { 21 {
@@ -327,6 +328,24 @@ class AbstractAction extends Controller_Abstract @@ -327,6 +328,24 @@ class AbstractAction extends Controller_Abstract
327 if (!empty($homeUrl)) { 328 if (!empty($homeUrl)) {
328 $header['navHome'] = $homeUrl; 329 $header['navHome'] = $homeUrl;
329 } 330 }
  331 +
  332 + // 根据COOKIE记录的频道进行导航定位
  333 + $channel = Helpers::getChannelByCookie();
  334 + switch ($channel) {
  335 + default:
  336 + case 1:
  337 + $header['boys'] = true;
  338 + break;
  339 + case 2:
  340 + $header['girls'] = true;
  341 + break;
  342 + case 3:
  343 + $header['kids'] = true;
  344 + break;
  345 + case 4:
  346 + $header['lifeStyle'] = true;
  347 + break;
  348 + }
330 349
331 $this->_view->assign('pageHeader', $header); 350 $this->_view->assign('pageHeader', $header);
332 } 351 }
@@ -67,14 +67,43 @@ class RecomData @@ -67,14 +67,43 @@ class RecomData
67 */ 67 */
68 public static function mayLikeLifestyle($page = 1, $limit = 50) 68 public static function mayLikeLifestyle($page = 1, $limit = 50)
69 { 69 {
70 - $param = Yohobuy::param();  
71 - $param['method'] = 'app.search.lifeStyle';  
72 - $param['page'] = $page;  
73 - $param['limit'] = $limit;  
74 - $param['yh_channel'] = '4';  
75 - $param['client_secret'] = Sign::getSign($param); 70 +// $param = Yohobuy::param();
  71 +// $param['method'] = 'app.search.lifeStyle';
  72 +// $param['page'] = $page;
  73 +// $param['limit'] = $limit;
  74 +// $param['yh_channel'] = '4';
  75 +// $param['client_secret'] = Sign::getSign($param);
  76 +//
  77 +// return Yohobuy::get(Yohobuy::API_URL, $param);
  78 +
  79 + // 人气单品
  80 + $param = array(
  81 + array(
  82 + 'stocknumber' => 1,
  83 + 'status' => 1,
  84 + 'order' => 's_n_desc',
  85 + 'viewNum' => $limit,
  86 + 'msort' => '10',
  87 + ),
  88 + 'N', false
  89 + );
  90 + $result['top'] = Yohobuy::yarClient(Yohobuy::SERVICE_URL . '/search/service/v1/product', 'search', $param, 3600); // 缓存1小时
76 91
77 - return Yohobuy::get(Yohobuy::API_URL, $param); 92 + // 新品到着
  93 + $param = array(
  94 + array('status' => 1, 'stocknumber' => 1, 'gender' => ''),
  95 + array(
  96 + array('misort' => 103, 'viewNum' => 10), //数码3c
  97 + array('misort' => 266, 'viewNum' => 10), //居家
  98 + array('misort' => 280, 'viewNum' => 10), //玩具娱乐
  99 + array('misort' => 101, 'viewNum' => 10), //办公文具
  100 + array('misort' => 259, 'viewNum' => 10), //美妆
  101 + ),
  102 + false
  103 + );
  104 + $result['new'] = Yohobuy::yarClient(Yohobuy::SERVICE_URL . '/search/service/v1/product', 'searchBySortList', $param, 3600); // 缓存1小时
  105 +
  106 + return $result;
78 } 107 }
79 108
80 } 109 }
@@ -17,7 +17,19 @@ use Api\Sign; @@ -17,7 +17,19 @@ use Api\Sign;
17 class SearchData 17 class SearchData
18 { 18 {
19 19
  20 + /**
  21 + * 阿里云外网
  22 + *
  23 + * @var string
  24 + */
20 protected static $_searchurl = 'http://101.200.31.165/yohosearch/search.json'; 25 protected static $_searchurl = 'http://101.200.31.165/yohosearch/search.json';
  26 +
  27 +// /**
  28 +// * 阿里云内网
  29 +// *
  30 +// * @var string
  31 +// */
  32 +// protected static $_searchurl = 'http://100.98.132.63/yohosearch/search.json';
21 33
22 /** 34 /**
23 * 模糊搜索提供的关键词 35 * 模糊搜索提供的关键词
@@ -8,7 +8,6 @@ var $ = require('yoho.zepto'), @@ -8,7 +8,6 @@ var $ = require('yoho.zepto'),
8 Swiper = require('yoho.iswiper'); 8 Swiper = require('yoho.iswiper');
9 9
10 var info = require('./info'), 10 var info = require('./info'),
11 - setLazyLoadAndMellipsis = info.setLazyLoadAndMellipsis,  
12 loadMore = info.loadMore; 11 loadMore = info.loadMore;
13 12
14 var $loadMoreInfo = $('#load-more-info'); 13 var $loadMoreInfo = $('#load-more-info');
@@ -45,10 +44,11 @@ info.initInfosEvt($infoList); @@ -45,10 +44,11 @@ info.initInfosEvt($infoList);
45 var gender = $('#gender').val(); 44 var gender = $('#gender').val();
46 45
47 $nav.children('.guang-nav-item').each(function() { 46 $nav.children('.guang-nav-item').each(function() {
48 - var type = $(this).data('type'); 47 + var type = $(this).data('type'),
  48 + focus = $(this).hasClass('focus');
49 49
50 state[type] = { 50 state[type] = {
51 - page: 1, 51 + page: focus ? 1 : 0,
52 gender: gender, 52 gender: gender,
53 type: type, 53 type: type,
54 end: false 54 end: false
@@ -65,6 +65,9 @@ $nav.delegate('.guang-nav-item', 'tap', function() { @@ -65,6 +65,9 @@ $nav.delegate('.guang-nav-item', 'tap', function() {
65 return; 65 return;
66 } 66 }
67 67
  68 + $curNav = $this;
  69 + curType = $this.data('type');
  70 +
68 index = $this.index(); 71 index = $this.index();
69 72
70 $this.addClass('focus'); 73 $this.addClass('focus');
@@ -75,11 +78,7 @@ $nav.delegate('.guang-nav-item', 'tap', function() { @@ -75,11 +78,7 @@ $nav.delegate('.guang-nav-item', 'tap', function() {
75 $content = $infos.eq(index); 78 $content = $infos.eq(index);
76 $content.removeClass('hide'); 79 $content.removeClass('hide');
77 80
78 - //lazyload & mellipsis  
79 - setLazyLoadAndMellipsis($content.children('.guang-info'));  
80 -  
81 - $curNav = $this;  
82 - curType = $this.data('type'); 81 + loadMore($content, state[curType]);
83 82
84 //重置当前Tab的load-more 83 //重置当前Tab的load-more
85 if (state[curType].end) { 84 if (state[curType].end) {
@@ -93,6 +92,6 @@ $nav.delegate('.guang-nav-item', 'tap', function() { @@ -93,6 +92,6 @@ $nav.delegate('.guang-nav-item', 'tap', function() {
93 92
94 $(document).scroll(function() { 93 $(document).scroll(function() {
95 if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) { 94 if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) {
96 - loadMore($infos, state[curType]); 95 + loadMore($infos.not('hide'), state[curType]);
97 } 96 }
98 }); 97 });
@@ -9,12 +9,13 @@ var $ = require('yoho.zepto'), @@ -9,12 +9,13 @@ var $ = require('yoho.zepto'),
9 lazyLoad = require('yoho.zeptolazyload'); 9 lazyLoad = require('yoho.zeptolazyload');
10 10
11 var tip = require('../plugin/tip'); 11 var tip = require('../plugin/tip');
  12 +var loading = require('../plugin/loading');
12 13
13 var $loadMoreInfo = $('#load-more-info'); 14 var $loadMoreInfo = $('#load-more-info');
14 var $loading = $(''), 15 var $loading = $(''),
15 $noMore = $(''); 16 $noMore = $('');
16 17
17 -var loading = false; 18 +var searching = false;
18 19
19 ellipsis.init(); 20 ellipsis.init();
20 21
@@ -84,7 +85,7 @@ function initInfosEvt($container) { @@ -84,7 +85,7 @@ function initInfosEvt($container) {
84 * 资讯LoadMore 85 * 资讯LoadMore
85 */ 86 */
86 function loadMore($container, opt) { 87 function loadMore($container, opt) {
87 - if (loading) { 88 + if (searching) {
88 return; 89 return;
89 } 90 }
90 91
@@ -92,7 +93,13 @@ function loadMore($container, opt) { @@ -92,7 +93,13 @@ function loadMore($container, opt) {
92 return; 93 return;
93 } 94 }
94 95
95 - loading = true; 96 + if (opt.page === 0) {
  97 +
  98 + //显示loading
  99 + loading.showLoadingMask();
  100 + }
  101 +
  102 + searching = true;
96 $.ajax({ 103 $.ajax({
97 type: 'GET', 104 type: 'GET',
98 url: ' /guang/index/page', 105 url: ' /guang/index/page',
@@ -100,7 +107,7 @@ function loadMore($container, opt) { @@ -100,7 +107,7 @@ function loadMore($container, opt) {
100 success: function(data) { 107 success: function(data) {
101 if (data === ' ') { 108 if (data === ' ') {
102 opt.end = true; 109 opt.end = true;
103 - loading = false; 110 + searching = false;
104 111
105 // 112 //
106 $loading.addClass('hide'); 113 $loading.addClass('hide');
@@ -112,13 +119,17 @@ function loadMore($container, opt) { @@ -112,13 +119,17 @@ function loadMore($container, opt) {
112 119
113 setLazyLoadAndMellipsis($container.find('.guang-info')); 120 setLazyLoadAndMellipsis($container.find('.guang-info'));
114 121
  122 + if (opt.page === 0) {
  123 + loading.hideLoadingMask();
  124 + }
  125 +
115 opt.page++; 126 opt.page++;
116 127
117 - loading = false; 128 + searching = false;
118 }, 129 },
119 error: function() { 130 error: function() {
120 tip.show('网络断开连接了~'); 131 tip.show('网络断开连接了~');
121 - loading = false; 132 + searching = false;
122 } 133 }
123 }); 134 });
124 } 135 }
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 7
8 var $ = require('yoho.zepto'); 8 var $ = require('yoho.zepto');
9 9
10 -var $filter = $('.filter-mask, .filter-body'); 10 +var $filter = $('.filter-mask');
11 11
12 var $classify = $filter.find('.classify'), 12 var $classify = $filter.find('.classify'),
13 $subClassify = $filter.find('.sub-classify'); 13 $subClassify = $filter.find('.sub-classify');
@@ -33,9 +33,11 @@ function registerCbFn(cb) { @@ -33,9 +33,11 @@ function registerCbFn(cb) {
33 $classify.children(':first-child').addClass('active'); //T:不在HTML中使用{{#if @first}}active{{/if}}来初始化active为避免sub设置高度时的闪烁 33 $classify.children(':first-child').addClass('active'); //T:不在HTML中使用{{#if @first}}active{{/if}}来初始化active为避免sub设置高度时的闪烁
34 34
35 //classify switch 35 //classify switch
36 -$classify.delegate('.classify-item', 'tap', function() { 36 +$classify.delegate('.classify-item', 'tap', function(e) {
37 var $this = $(this); 37 var $this = $(this);
38 38
  39 + e.stopPropagation();
  40 +
39 if ($this.hasClass('active')) { 41 if ($this.hasClass('active')) {
40 return; 42 return;
41 } 43 }
@@ -46,7 +48,7 @@ $classify.delegate('.classify-item', 'tap', function() { @@ -46,7 +48,7 @@ $classify.delegate('.classify-item', 'tap', function() {
46 }); 48 });
47 49
48 //点击Mask隐藏筛选界面 50 //点击Mask隐藏筛选界面
49 -$filter.filter('.filter-mask').tap(function() { 51 +$filter.tap(function() {
50 hideFilter(); 52 hideFilter();
51 }); 53 });
52 54
@@ -10,17 +10,14 @@ var $page = $('.yoho-page'); @@ -10,17 +10,14 @@ var $page = $('.yoho-page');
10 10
11 var $loading; 11 var $loading;
12 12
13 -/**  
14 - * 初始化loading mask  
15 - * @param $container loading容器, position:relative  
16 - */  
17 -function initLoadingMask() { 13 +//初始化
  14 +(function() {
18 var html = '<div class="loading-mask hide"><div class="loading"></div></div>'; 15 var html = '<div class="loading-mask hide"><div class="loading"></div></div>';
19 16
20 $page.append(html); 17 $page.append(html);
21 18
22 $loading = $page.children('.loading-mask'); 19 $loading = $page.children('.loading-mask');
23 -} 20 +}());
24 21
25 //显示loading 22 //显示loading
26 function showLoadingMask() { 23 function showLoadingMask() {
@@ -32,6 +29,5 @@ function hideLoadingMask() { @@ -32,6 +29,5 @@ function hideLoadingMask() {
32 $loading.addClass('hide'); 29 $loading.addClass('hide');
33 } 30 }
34 31
35 -exports.initLoadingMask = initLoadingMask;  
36 exports.showLoadingMask = showLoadingMask; 32 exports.showLoadingMask = showLoadingMask;
37 exports.hideLoadingMask = hideLoadingMask; 33 exports.hideLoadingMask = hideLoadingMask;
@@ -209,7 +209,6 @@ function search(opt) { @@ -209,7 +209,6 @@ function search(opt) {
209 lazyLoad($('.lazy')); 209 lazyLoad($('.lazy'));
210 210
211 filter.registerCbFn(search); 211 filter.registerCbFn(search);
212 -loading.initLoadingMask();  
213 212
214 //导航栏点击逻辑说明: 213 //导航栏点击逻辑说明:
215 //1.点击非active项时切换active状态 214 //1.点击非active项时切换active状态
1 .loading-mask { 1 .loading-mask {
2 position: absolute; 2 position: absolute;
3 - background: rgba(0,0,0,.3); 3 + background: rgba(0,0,0,.1);
4 top: 0; 4 top: 0;
5 bottom: 0; 5 bottom: 0;
6 right: 0; 6 right: 0;
1 {{# filter}} 1 {{# filter}}
2 - <div class="filter-mask hide"></div>  
3 - <div class="filter-body hide">  
4 - <ul class="classify">  
5 - {{#each classify}}  
6 - <li class="classify-item">  
7 - <p class="shower{{#if default}} default{{/if}}">  
8 - <span class="title">{{title}}:</span>  
9 - {{name}}  
10 - </p>  
11 - <ul class="sub-classify" data-type={{dataType}}>  
12 - {{# subs}}  
13 - <li {{#if chosed}}class=chosed{{/if}} data-id={{dataId}}>  
14 - {{name}}  
15 - <i class="iconfont chosed-icon">&#xe617;</i>  
16 - </li>  
17 - {{/ subs}}  
18 - </ul>  
19 - </li>  
20 - {{/each}}  
21 - </ul> 2 + <div class="filter-mask hide">
  3 + <div class="filter-body">
  4 + <ul class="classify">
  5 + {{#each classify}}
  6 + <li class="classify-item">
  7 + <p class="shower{{#if default}} default{{/if}}">
  8 + <span class="title">{{title}}:</span>
  9 + {{name}}
  10 + </p>
  11 + <ul class="sub-classify" data-type={{dataType}}>
  12 + {{# subs}}
  13 + <li {{#if chosed}}class=chosed{{/if}} data-id={{dataId}}>
  14 + {{name}}
  15 + <i class="iconfont chosed-icon">&#xe617;</i>
  16 + </li>
  17 + {{/ subs}}
  18 + </ul>
  19 + </li>
  20 + {{/each}}
  21 + </ul>
  22 + </div>
22 </div> 23 </div>
23 {{/ filter}} 24 {{/ filter}}
@@ -91,7 +91,82 @@ class IndexModel @@ -91,7 +91,82 @@ class IndexModel
91 $data['guang']['gender'] = $gender; 91 $data['guang']['gender'] = $gender;
92 92
93 $category = array(); 93 $category = array();
94 - 94 +
  95 + return $data;
  96 + }
  97 +
  98 + /**
  99 + * 获取逛首页分类内容列表
  100 + *
  101 + * @param string $gender "1,3"表示男, "2,3"表示女
  102 + * @param int channel APP客户端标识 1表示男,2:表示女,3:潮童,4:创意生活
  103 + * @param int type 分类ID 0:最新,1:话题,2:搭配,3:潮人,4:潮品,5:小贴士
  104 + * @param int $uid 用户ID
  105 + * @param string $udid 客户端唯一标识
  106 + * @param int $page 分页第几页, 默认第1页
  107 + * @return array
  108 + */
  109 + public static function getArticle($gender, $type, $uid, $udid, $page = 1)
  110 + {
  111 + // 逛首页的分类名称列表
  112 + $category = ListData::category();
  113 + $article = array();
  114 +
  115 + switch ($gender) {
  116 + case '1,3': // 男
  117 + $article = ListData::article('1,3', $type, $uid, $udid, $page);
  118 + break;
  119 + case '2,3': // 女
  120 + $article = ListData::article('2,3', $type, $uid, $udid, $page);
  121 + break;
  122 + default: // 其它所有
  123 + $article = ListData::article('1,2,3', $type, $uid, $udid, $page);
  124 + break;
  125 + }
  126 +
  127 + $data = array();
  128 + $build = array();
  129 +
  130 + // 模板中使用JS的标识
  131 + $data['guangHome'] = true;
  132 +
  133 + // 顶部的分类列表
  134 + if (!empty($category['data'])) {
  135 + foreach ($category['data'] as $value) {
  136 + $build = array();
  137 + $build['typeId'] = $value['id'];
  138 + $build['type'] = $value['name'];
  139 + $build['focus'] = ($value['id'] == $type);
  140 + $data['navs'][] = $build;
  141 +
  142 + $data['guang']['infos'][] = array(
  143 + 'show' => $build['focus'],
  144 + 'info' => array(),
  145 + );
  146 + }
  147 + }
  148 +
  149 + // 广告列表
  150 + if (!empty($article['data']['list']['adlist'])) {
  151 + foreach ($article['data']['list']['adlist'] as $value) {
  152 + $build = array();
  153 + $build['url'] = Helpers::getFilterUrl($value['url']);
  154 + $build['img'] = Helpers::getImageUrl($value['src'], 830, 327);
  155 + $data['guang']['swiper'][] = $build;
  156 + }
  157 + }
  158 +
  159 + // 内容列表
  160 + if (!empty($article['data']['list']['artlist'])) {
  161 + $type = intval($type);
  162 + foreach ($article['data']['list']['artList'] as $value) {
  163 + $data['guang']['infos'][$type]['info'] = Helpers::formatArticle($value, true, false, true);
  164 + }
  165 + }
  166 +
  167 + $category = array();
  168 + $article = array();
  169 +
95 return $data; 170 return $data;
96 } 171 }
97 172
@@ -35,7 +35,7 @@ class IndexController extends AbstractAction @@ -35,7 +35,7 @@ class IndexController extends AbstractAction
35 // $this->setNavSide('all'); 35 // $this->setNavSide('all');
36 // } 36 // }
37 37
38 - $this->_view->display('index', Guang\IndexModel::getArticleGroup($gender, $type, $uid, $udid)); 38 + $this->_view->display('index', Guang\IndexModel::getArticle($gender, $type, $uid, $udid));
39 } 39 }
40 40
41 /** 41 /**
@@ -175,7 +175,7 @@ class IndexController extends AbstractAction @@ -175,7 +175,7 @@ class IndexController extends AbstractAction
175 /* 获取资讯文章列表 */ 175 /* 获取资讯文章列表 */
176 $uid = $this->getUid(); 176 $uid = $this->getUid();
177 $udid = $this->getUdid(); 177 $udid = $this->getUdid();
178 - $page = intval($page) + 1; 178 + //$page = intval($page) + 1;
179 $article = ListData::article($gender, $sortId, $uid, $udid, $page, $tag, $authorId); 179 $article = ListData::article($gender, $sortId, $uid, $udid, $page, $tag, $authorId);
180 if (empty($article['data']['list']['artList'])) { 180 if (empty($article['data']['list']['artList'])) {
181 break; 181 break;
@@ -31,6 +31,11 @@ class InfoController extends AbstractAction @@ -31,6 +31,11 @@ class InfoController extends AbstractAction
31 $this->error(); 31 $this->error();
32 } 32 }
33 33
  34 + // WAP上设置头部导航
  35 + if (null === $this->get('openby:yohobuy', null)) {
  36 + $this->setNavHeader('逛', true, SITE_MAIN);
  37 + }
  38 +
34 $data = array(); 39 $data = array();
35 $data['guangDetail'] = true; // 模板中使用JS的标识 40 $data['guangDetail'] = true; // 模板中使用JS的标识
36 $data['guang']['id'] = $id; 41 $data['guang']['id'] = $id;
@@ -85,7 +85,7 @@ class IndexController extends AbstractAction @@ -85,7 +85,7 @@ class IndexController extends AbstractAction
85 if (!isset($brandIds[0])) { 85 if (!isset($brandIds[0])) {
86 $this->error(); 86 $this->error();
87 } 87 }
88 - 88 +
89 // 当前的登录用户UID 89 // 当前的登录用户UID
90 $uid = $this->getUid(); 90 $uid = $this->getUid();
91 // 存标题信息 91 // 存标题信息
@@ -107,6 +107,7 @@ class IndexController extends AbstractAction @@ -107,6 +107,7 @@ class IndexController extends AbstractAction
107 'gender' => FILTER_DEFAULT, 107 'gender' => FILTER_DEFAULT,
108 'p_d' => FILTER_DEFAULT,), false); 108 'p_d' => FILTER_DEFAULT,), false);
109 $condition['brand'] = $brandIds[0]; 109 $condition['brand'] = $brandIds[0];
  110 +
110 if (isset($condition['gender'])) { 111 if (isset($condition['gender'])) {
111 $condition['gender'] = rawurldecode($condition['gender']); 112 $condition['gender'] = rawurldecode($condition['gender']);
112 } 113 }
@@ -118,7 +119,7 @@ class IndexController extends AbstractAction @@ -118,7 +119,7 @@ class IndexController extends AbstractAction
118 $data['goodList']['brandWay'] = false; 119 $data['goodList']['brandWay'] = false;
119 $data['goodList']['search']['default'] = $query; 120 $data['goodList']['search']['default'] = $query;
120 $data['goodList']['search']['url'] = Helpers::url('', null, 'search'); 121 $data['goodList']['search']['url'] = Helpers::url('', null, 'search');
121 - } 122 + }
122 // 品牌一览过来的展示品牌介绍和LOGO 123 // 品牌一览过来的展示品牌介绍和LOGO
123 else { 124 else {
124 $data['brandHome'] = Product\ListModel::getBrandIntro($brandIds[0], $uid, $title); 125 $data['brandHome'] = Product\ListModel::getBrandIntro($brandIds[0], $uid, $title);
@@ -47,8 +47,8 @@ class RecomController extends AbstractAction @@ -47,8 +47,8 @@ class RecomController extends AbstractAction
47 if (empty($recom['data']['product_list'])) { 47 if (empty($recom['data']['product_list'])) {
48 break; 48 break;
49 } 49 }
50 -  
51 - /* 判断是否已没有数据 */ 50 +
  51 + /* 判断是否已没有数据 */
52 if (intval($page) > intval($recom['data']['page_total'])) { 52 if (intval($page) > intval($recom['data']['page_total'])) {
53 break; 53 break;
54 } 54 }
@@ -59,7 +59,6 @@ class RecomController extends AbstractAction @@ -59,7 +59,6 @@ class RecomController extends AbstractAction
59 $data['goods'][] = Helpers::formatProduct($value, true); 59 $data['goods'][] = Helpers::formatProduct($value, true);
60 } 60 }
61 $this->_view->display('maylike', $data); 61 $this->_view->display('maylike', $data);
62 -  
63 } while (false); 62 } while (false);
64 63
65 echo ' '; 64 echo ' ';
@@ -120,32 +119,65 @@ class RecomController extends AbstractAction @@ -120,32 +119,65 @@ class RecomController extends AbstractAction
120 if (!$this->isAjax()) { 119 if (!$this->isAjax()) {
121 break; 120 break;
122 } 121 }
  122 +
  123 + /* 创意生活只有一页数据 */
  124 + $page = $this->get('page', 1);
  125 + if (intval($page) > 1) {
  126 + break;
  127 + }
123 128
124 /* 取可能喜欢的数据 */ 129 /* 取可能喜欢的数据 */
125 $recom = RecomData::mayLikeLifestyle(); 130 $recom = RecomData::mayLikeLifestyle();
126 - if (empty($recom['data']['product_list'])) { 131 +
  132 + /* 构建人气单品数据 */
  133 + if (empty($recom['top']['data']['product_list'])) {
127 break; 134 break;
128 } 135 }
129 -  
130 - /* 构建模板需要的商品数据 */ 136 +
131 $data = array(); 137 $data = array();
  138 +
  139 + $build = array();
  140 + $build['show'] = true;
  141 + foreach ($recom['top']['data']['product_list'] as $value) {
  142 + $build['goods'][] = Helpers::formatProduct($value, true, false, false);
  143 + }
  144 + $data['goodsContainer'][] = $build;
  145 +
  146 + /* 构建新品到着数据 */
  147 + if (empty($recom['new']['data']['product_list'])) {
  148 + break;
  149 + }
132 $build = array(); 150 $build = array();
133 - if (!empty($recom['data']['product_list']['top'])) {  
134 - $build = array();  
135 - $build['show'] = true;  
136 - foreach ($recom['data']['product_list']['top'] as $value) {  
137 - $build['goods'][] = Helpers::formatProduct($value, true);  
138 - }  
139 - $data['goodsContainer'][] = $build;  
140 - }  
141 - if (!empty($recom['data']['product_list']['new'])) {  
142 - $build = array();  
143 - foreach ($recom['data']['product_list']['new'] as $value) {  
144 - $build['show'] = false;  
145 - $build['goods'][] = Helpers::formatProduct($value, true);  
146 - }  
147 - $data['goodsContainer'][] = $build; 151 + $build['show'] = true;
  152 + foreach ($recom['new']['data']['product_list'] as $value) {
  153 + $build['goods'][] = Helpers::formatProduct($value, true, false, false);
148 } 154 }
  155 + $data['goodsContainer'][] = $build;
  156 +
  157 +// if (empty($recom['data']['product_list'])) {
  158 +// break;
  159 +// }
  160 +//
  161 +// /* 构建模板需要的商品数据 */
  162 +// $data = array();
  163 +// $build = array();
  164 +// if (!empty($recom['data']['product_list']['top'])) {
  165 +// $build = array();
  166 +// $build['show'] = true;
  167 +// foreach ($recom['data']['product_list']['top'] as $value) {
  168 +// $build['goods'][] = Helpers::formatProduct($value, true);
  169 +// }
  170 +// $data['goodsContainer'][] = $build;
  171 +// }
  172 +// if (!empty($recom['data']['product_list']['new'])) {
  173 +// $build = array();
  174 +// foreach ($recom['data']['product_list']['new'] as $value) {
  175 +// $build['show'] = false;
  176 +// $build['goods'][] = Helpers::formatProduct($value, true);
  177 +// }
  178 +// $data['goodsContainer'][] = $build;
  179 +// }
  180 +
149 $this->_view->display('maylikelife', $data); 181 $this->_view->display('maylikelife', $data);
150 182
151 } while (false); 183 } while (false);
@@ -5,7 +5,7 @@ define('SITE_MAIN', 'http://buy.test.yoho.cn'); // 网站主域名 @@ -5,7 +5,7 @@ define('SITE_MAIN', 'http://buy.test.yoho.cn'); // 网站主域名
5 define('OLD_MAIN', 'http://m.yohobuy.com'); // 网站旧域名 5 define('OLD_MAIN', 'http://m.yohobuy.com'); // 网站旧域名
6 define('COOKIE_DOMAIN', '.test.yoho.cn'); // COOKIE作用域 6 define('COOKIE_DOMAIN', '.test.yoho.cn'); // COOKIE作用域
7 define('SUB_DOMAIN', '.test.yoho.cn'); // 子域名后缀 7 define('SUB_DOMAIN', '.test.yoho.cn'); // 子域名后缀
8 -define('USE_CACHE', true); // 缓存的开关 8 +define('USE_CACHE', false); // 缓存的开关
9 define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录 9 define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录
10 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录 10 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录
11 defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'testing'); 11 defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'testing');