Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
Showing
29 changed files
with
190 additions
and
103 deletions
framework @ 75bbc3b0
@@ -387,16 +387,4 @@ class AbstractAction extends Controller_Abstract | @@ -387,16 +387,4 @@ class AbstractAction extends Controller_Abstract | ||
387 | $this->_view->assign('sideNav', \Index\SideModel::getLeftNav($guangChoosed)); | 387 | $this->_view->assign('sideNav', \Index\SideModel::getLeftNav($guangChoosed)); |
388 | } | 388 | } |
389 | 389 | ||
390 | - /** | ||
391 | - * 设置首页以及频道页顶部信息 | ||
392 | - * | ||
393 | - * @return void | ||
394 | - */ | ||
395 | - protected function setHomeChannelHeader() | ||
396 | - { | ||
397 | - $header['searchUrl'] = '/search'; | ||
398 | - | ||
399 | - $this->_view->assign('homeHeader', $header); | ||
400 | - } | ||
401 | - | ||
402 | } | 390 | } |
@@ -38,5 +38,6 @@ class CacheConfig | @@ -38,5 +38,6 @@ class CacheConfig | ||
38 | const KEY_ACTION_PRODUCT_BRAND = 'key_action_product_brand'; // 品类商品列表 | 38 | const KEY_ACTION_PRODUCT_BRAND = 'key_action_product_brand'; // 品类商品列表 |
39 | const KEY_ACTION_PRODUCT_BRAND_DOMAINS = 'key_action_product_brand_domains'; // 所有品牌域名列表 | 39 | const KEY_ACTION_PRODUCT_BRAND_DOMAINS = 'key_action_product_brand_domains'; // 所有品牌域名列表 |
40 | const KEY_ACTION_PRODUCT_BRAND_NAMES = 'key_action_product_brand_names'; // 所有品牌名称列表 | 40 | const KEY_ACTION_PRODUCT_BRAND_NAMES = 'key_action_product_brand_names'; // 所有品牌名称列表 |
41 | + const KEY_ACTION_PRODUCT_BRAND_LOGO = 'key_action_product_brand_logo'; // 品牌信息 | ||
41 | 42 | ||
42 | } | 43 | } |
@@ -45,9 +45,9 @@ class BrandData | @@ -45,9 +45,9 @@ class BrandData | ||
45 | $param['method'] = 'app.brand.brandlist'; | 45 | $param['method'] = 'app.brand.brandlist'; |
46 | $param['yh_channel'] = $channel; | 46 | $param['yh_channel'] = $channel; |
47 | $param['client_secret'] = Sign::getSign($param); | 47 | $param['client_secret'] = Sign::getSign($param); |
48 | - $urlList['brandList'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param, 3600); // 有缓存1小时 | 48 | + $urlList['brandList'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param); |
49 | 49 | ||
50 | - return Yohobuy::getMulti($urlList); | 50 | + return Yohobuy::getMulti($urlList, array(), 3600); // 有缓存1小时 |
51 | } | 51 | } |
52 | 52 | ||
53 | /** | 53 | /** |
@@ -202,4 +202,15 @@ class BrandData | @@ -202,4 +202,15 @@ class BrandData | ||
202 | return Yohobuy::get(Yohobuy::API_URL, $param); | 202 | return Yohobuy::get(Yohobuy::API_URL, $param); |
203 | } | 203 | } |
204 | 204 | ||
205 | + /** | ||
206 | + * 获取品牌LOGO信息 | ||
207 | + * | ||
208 | + * @param int $id 用户ID | ||
209 | + * @return array | ||
210 | + */ | ||
211 | + public static function getBrandLogo($id) | ||
212 | + { | ||
213 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . '/shops/service/v1/brand', 'getBrandByids', array($id )); | ||
214 | + } | ||
215 | + | ||
205 | } | 216 | } |
@@ -246,12 +246,21 @@ class Helpers | @@ -246,12 +246,21 @@ class Helpers | ||
246 | $result['text'] = $articleData['intro']; | 246 | $result['text'] = $articleData['intro']; |
247 | $result['publishTime'] = $articleData['publish_time']; | 247 | $result['publishTime'] = $articleData['publish_time']; |
248 | $result['pageView'] = $articleData['views_num']; | 248 | $result['pageView'] = $articleData['views_num']; |
249 | + | ||
250 | + // 收藏 | ||
251 | + if ($isApp) { | ||
252 | + $result['collect'] = array(); | ||
253 | + $result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y'; | ||
254 | + $result['collect']['url'] = $articleData['url']; | ||
255 | + } | ||
256 | + // 点赞 | ||
257 | + else { | ||
249 | $result['like'] = array(); | 258 | $result['like'] = array(); |
250 | $result['like']['count'] = $articleData['praise_num']; | 259 | $result['like']['count'] = $articleData['praise_num']; |
251 | $result['like']['isLiked'] = isset($articleData['isPraise']) && $articleData['isPraise'] === 'Y'; | 260 | $result['like']['isLiked'] = isset($articleData['isPraise']) && $articleData['isPraise'] === 'Y'; |
252 | - // 收藏 | ||
253 | - // $result['collect'] = array(); | ||
254 | - // $result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y'; | 261 | + } |
262 | + | ||
263 | + // 分享链接 | ||
255 | $result['share'] = $isApp && isset($articleData['share']['url']) ? $articleData['share']['url'] : false; | 264 | $result['share'] = $isApp && isset($articleData['share']['url']) ? $articleData['share']['url'] : false; |
256 | 265 | ||
257 | // 判断是否显示作者信息 | 266 | // 判断是否显示作者信息 |
@@ -5,6 +5,10 @@ | @@ -5,6 +5,10 @@ | ||
5 | */ | 5 | */ |
6 | var $ = require('jquery'); | 6 | var $ = require('jquery'); |
7 | 7 | ||
8 | +var $footer = $('#yoho-footer'); | ||
9 | + | ||
10 | +var FOOTERHEIGHT = 120; //footer height | ||
11 | + | ||
8 | function cookie(name) { | 12 | function cookie(name) { |
9 | var cookies = document.cookie, | 13 | var cookies = document.cookie, |
10 | cookieVal, | 14 | cookieVal, |
@@ -90,14 +94,26 @@ function getShoppingKey() { | @@ -90,14 +94,26 @@ function getShoppingKey() { | ||
90 | return JSON.parse(c).k; | 94 | return JSON.parse(c).k; |
91 | } | 95 | } |
92 | 96 | ||
97 | +//根据页面内容重新设置通用底部的显示 | ||
98 | +function rePosFooter() { | ||
99 | + if ($footer.length === 0) { | ||
100 | + return; | ||
101 | + } | ||
102 | + | ||
103 | + if ($('body').height() < $(window).height() - FOOTERHEIGHT) { | ||
104 | + $footer.addClass('bottom'); | ||
105 | + } else { | ||
106 | + $footer.removeClass('bottom'); | ||
107 | + } | ||
108 | +} | ||
109 | + | ||
93 | //页面通用底部位置及status设置 | 110 | //页面通用底部位置及status设置 |
94 | (function () { | 111 | (function () { |
95 | - var $footer = $('#yoho-footer'), | ||
96 | - $op = $footer.children('.op-row'); | 112 | + var $op = $footer.children('.op-row'); |
97 | 113 | ||
98 | var user = getUser(); | 114 | var user = getUser(); |
99 | 115 | ||
100 | - if ($('body').height() < $(window).height()) { | 116 | + if ($('body').height() < $(window).height() - FOOTERHEIGHT) { |
101 | $footer.addClass('bottom'); | 117 | $footer.addClass('bottom'); |
102 | } | 118 | } |
103 | 119 | ||
@@ -132,3 +148,5 @@ window.getUser = getUser; | @@ -132,3 +148,5 @@ window.getUser = getUser; | ||
132 | window.getUid = getUid; | 148 | window.getUid = getUid; |
133 | 149 | ||
134 | window.getShoppingKey = getShoppingKey; | 150 | window.getShoppingKey = getShoppingKey; |
151 | + | ||
152 | +window.rePosFooter = rePosFooter; |
@@ -61,7 +61,7 @@ cHammer.on('tap', function() { | @@ -61,7 +61,7 @@ cHammer.on('tap', function() { | ||
61 | continue; | 61 | continue; |
62 | } | 62 | } |
63 | 63 | ||
64 | - html += '<li><a href="/?query=' + history + '">' + history + '</li>'; | 64 | + html += '<li><a href="http://search.m.yohobuy.com/?query=' + history + '">' + history + '</li>'; |
65 | } | 65 | } |
66 | 66 | ||
67 | $history.html(html); | 67 | $history.html(html); |
@@ -16,17 +16,25 @@ | @@ -16,17 +16,25 @@ | ||
16 | border-radius: 30rem / $pxConvertRem; | 16 | border-radius: 30rem / $pxConvertRem; |
17 | padding: 0 32rem / $pxConvertRem 0 52rem / $pxConvertRem; | 17 | padding: 0 32rem / $pxConvertRem 0 52rem / $pxConvertRem; |
18 | 18 | ||
19 | - .search-input { | 19 | + a { |
20 | width: 100%; | 20 | width: 100%; |
21 | height: 60rem / $pxConvertRem; | 21 | height: 60rem / $pxConvertRem; |
22 | border: 0; | 22 | border: 0; |
23 | + display: block; | ||
24 | + span{ | ||
25 | + line-height: 60rem / $pxConvertRem; | ||
26 | + color: #bdbdbd; | ||
27 | + font-size: 1.2em; | ||
28 | + padding-left: 18rem / $pxConvertRem; | ||
29 | + } | ||
23 | } | 30 | } |
24 | 31 | ||
25 | .search-icon { | 32 | .search-icon { |
26 | position: absolute; | 33 | position: absolute; |
27 | font-size: 24rem / $pxConvertRem; | 34 | font-size: 24rem / $pxConvertRem; |
28 | - top: 20rem / $pxConvertRem; | 35 | + top: 0; |
29 | left: 24rem / $pxConvertRem; | 36 | left: 24rem / $pxConvertRem; |
37 | + line-height: 60rem / $pxConvertRem; | ||
30 | color: #bdbdbd; | 38 | color: #bdbdbd; |
31 | } | 39 | } |
32 | 40 |
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | margin-top: 30rem / $pxConvertRem; | 6 | margin-top: 30rem / $pxConvertRem; |
7 | .title { | 7 | .title { |
8 | height: 104rem / $pxConvertRem; | 8 | height: 104rem / $pxConvertRem; |
9 | + font-size: 38rem / $pxConvertRem; | ||
9 | line-height: 104rem / $pxConvertRem; | 10 | line-height: 104rem / $pxConvertRem; |
10 | text-align: center; | 11 | text-align: center; |
11 | color: #dadada; | 12 | color: #dadada; |
@@ -3,7 +3,8 @@ | @@ -3,7 +3,8 @@ | ||
3 | <div class="newbrand-search"> | 3 | <div class="newbrand-search"> |
4 | <div class="search-box clearfix"> | 4 | <div class="search-box clearfix"> |
5 | <a href="{{searchUrl}}" > | 5 | <a href="{{searchUrl}}" > |
6 | - <input type="text" class="search-input" placeholder="查找品牌"> | 6 | + <!-- <input type="text" class="search-input" placeholder="查找品牌"> --> |
7 | + <span>查找品牌</span> | ||
7 | <i class="search-icon iconfont"></i> | 8 | <i class="search-icon iconfont"></i> |
8 | </a> | 9 | </a> |
9 | </div> | 10 | </div> |
@@ -20,46 +20,39 @@ class BoysController extends AbstractAction | @@ -20,46 +20,39 @@ class BoysController extends AbstractAction | ||
20 | // 设置网站标题 | 20 | // 设置网站标题 |
21 | $this->setTitle('男生首页'); | 21 | $this->setTitle('男生首页'); |
22 | // 显示侧边栏 | 22 | // 显示侧边栏 |
23 | - $this->setNavSide(); | ||
24 | - // 设置顶部信息(搜索) | ||
25 | - $this->setHomeChannelHeader(); | 23 | + $this->setNavSide('boys'); |
26 | 24 | ||
27 | // 渲染模板并输出 | 25 | // 渲染模板并输出 |
28 | $this->_view->display('index', array( | 26 | $this->_view->display('index', array( |
29 | 'boysHomePage' => true, | 27 | 'boysHomePage' => true, |
30 | - 'showFooterTab'=> false, | 28 | + 'homeHeader' => array('searchUrl' => Helpers::url('/search.html', null, 'search')), |
29 | + 'showFooterTab' => false, | ||
31 | 'maybeLike' => true, | 30 | 'maybeLike' => true, |
32 | 'content' => Index\HomeModel::getBoysFloor(), | 31 | 'content' => Index\HomeModel::getBoysFloor(), |
33 | 'pageFooter' => true, | 32 | 'pageFooter' => true, |
34 | )); | 33 | )); |
35 | - | ||
36 | } | 34 | } |
37 | 35 | ||
38 | - | ||
39 | /** | 36 | /** |
40 | * 异步获取男首底部banner数据 | 37 | * 异步获取男首底部banner数据 |
41 | * @return string 底部Banner数据 | 38 | * @return string 底部Banner数据 |
42 | */ | 39 | */ |
43 | public function bottomBannerAction() | 40 | public function bottomBannerAction() |
44 | { | 41 | { |
45 | - do | ||
46 | - { | ||
47 | - if(!$this->isAjax()) | ||
48 | - { | 42 | + do { |
43 | + if (!$this->isAjax()) { | ||
49 | break; | 44 | break; |
50 | } | 45 | } |
51 | 46 | ||
52 | $channel = Helpers::getChannelByCookie(); | 47 | $channel = Helpers::getChannelByCookie(); |
53 | $bottomBanner = Index\HomeModel::getBottomBanner($channel); | 48 | $bottomBanner = Index\HomeModel::getBottomBanner($channel); |
49 | + if (empty($bottomBanner)) { | ||
50 | + break; | ||
51 | + } | ||
54 | 52 | ||
55 | - if($bottomBanner) | ||
56 | - { | ||
57 | $this->echoJson($bottomBanner); | 53 | $this->echoJson($bottomBanner); |
58 | - } | ||
59 | - } | ||
60 | - while(false); | ||
61 | 54 | ||
62 | - echo ' '; | 55 | + } while (false); |
63 | } | 56 | } |
64 | 57 | ||
65 | } | 58 | } |
@@ -20,45 +20,39 @@ class GirlsController extends AbstractAction | @@ -20,45 +20,39 @@ class GirlsController extends AbstractAction | ||
20 | // 设置网站标题 | 20 | // 设置网站标题 |
21 | $this->setTitle('女生首页'); | 21 | $this->setTitle('女生首页'); |
22 | // 显示侧边栏 | 22 | // 显示侧边栏 |
23 | - $this->setNavSide(); | ||
24 | - // 设置顶部信息(搜索) | ||
25 | - $this->setHomeChannelHeader(); | 23 | + $this->setNavSide('girls'); |
26 | 24 | ||
27 | // 渲染模板并输出 | 25 | // 渲染模板并输出 |
28 | $this->_view->display('index', array( | 26 | $this->_view->display('index', array( |
29 | 'grilsHomePage' => true, | 27 | 'grilsHomePage' => true, |
30 | - 'showFooterTab'=> false, | 28 | + 'homeHeader' => array('searchUrl' => Helpers::url('/search.html', null, 'search')), |
29 | + 'showFooterTab' => false, | ||
31 | 'maybeLike' => true, | 30 | 'maybeLike' => true, |
32 | 'content' => Index\HomeModel::getGirlsFloor(), | 31 | 'content' => Index\HomeModel::getGirlsFloor(), |
33 | 'pageFooter' => true, | 32 | 'pageFooter' => true, |
34 | )); | 33 | )); |
35 | } | 34 | } |
36 | 35 | ||
37 | - | ||
38 | /** | 36 | /** |
39 | * 异步获取女首底部banner数据 | 37 | * 异步获取女首底部banner数据 |
40 | * @return string 底部Banner数据 | 38 | * @return string 底部Banner数据 |
41 | */ | 39 | */ |
42 | public function bottomBannerAction() | 40 | public function bottomBannerAction() |
43 | { | 41 | { |
44 | - do | ||
45 | - { | ||
46 | - if(!$this->isAjax()) | ||
47 | - { | 42 | + do { |
43 | + if (!$this->isAjax()) { | ||
48 | break; | 44 | break; |
49 | } | 45 | } |
50 | 46 | ||
51 | $channel = Helpers::getChannelByCookie(); | 47 | $channel = Helpers::getChannelByCookie(); |
52 | $bottomBanner = Index\HomeModel::getBottomBanner($channel); | 48 | $bottomBanner = Index\HomeModel::getBottomBanner($channel); |
49 | + if (empty($bottomBanner)) { | ||
50 | + break; | ||
51 | + } | ||
53 | 52 | ||
54 | - if($bottomBanner) | ||
55 | - { | ||
56 | $this->echoJson($bottomBanner); | 53 | $this->echoJson($bottomBanner); |
57 | - } | ||
58 | - } | ||
59 | - while(false); | ||
60 | 54 | ||
61 | - echo ' '; | 55 | + } while (false); |
62 | } | 56 | } |
63 | 57 | ||
64 | } | 58 | } |
@@ -15,7 +15,7 @@ class IndexController extends AbstractAction | @@ -15,7 +15,7 @@ class IndexController extends AbstractAction | ||
15 | public function indexAction() | 15 | public function indexAction() |
16 | { | 16 | { |
17 | // 先检查COOKIE是否有访问过, 有则跳转到相应的频道页 | 17 | // 先检查COOKIE是否有访问过, 有则跳转到相应的频道页 |
18 | - Index\HomeModel::goSwitchChannel(); | 18 | + // Index\HomeModel::goSwitchChannel(); |
19 | 19 | ||
20 | // 渲染模板 | 20 | // 渲染模板 |
21 | $this->_view->display('index', array( | 21 | $this->_view->display('index', array( |
@@ -20,13 +20,12 @@ class KidsController extends AbstractAction | @@ -20,13 +20,12 @@ class KidsController extends AbstractAction | ||
20 | $this->setTitle('潮童首页'); | 20 | $this->setTitle('潮童首页'); |
21 | // 显示侧边栏 | 21 | // 显示侧边栏 |
22 | $this->setNavSide(); | 22 | $this->setNavSide(); |
23 | - // 设置顶部信息(搜索) | ||
24 | - $this->setHomeChannelHeader(); | ||
25 | 23 | ||
26 | // 渲染模板并输出 | 24 | // 渲染模板并输出 |
27 | $this->_view->display('index', array( | 25 | $this->_view->display('index', array( |
28 | 'kidsHomePage' => true, | 26 | 'kidsHomePage' => true, |
29 | - 'showFooterTab'=> false, | 27 | + 'homeHeader' => array('searchUrl' => Helpers::url('/search.html', null, 'search')), |
28 | + 'showFooterTab' => false, | ||
30 | 'maybeLike' => true, | 29 | 'maybeLike' => true, |
31 | 'content' => Index\HomeModel::getKidsFloor(), | 30 | 'content' => Index\HomeModel::getKidsFloor(), |
32 | 'pageFooter' => true, | 31 | 'pageFooter' => true, |
@@ -20,13 +20,12 @@ class LifestyleController extends AbstractAction | @@ -20,13 +20,12 @@ class LifestyleController extends AbstractAction | ||
20 | $this->setTitle('创意生活首页'); | 20 | $this->setTitle('创意生活首页'); |
21 | // 显示侧边栏 | 21 | // 显示侧边栏 |
22 | $this->setNavSide(); | 22 | $this->setNavSide(); |
23 | - // 设置顶部信息(搜索) | ||
24 | - $this->setHomeChannelHeader(); | ||
25 | 23 | ||
26 | // 渲染模板并输出 | 24 | // 渲染模板并输出 |
27 | $this->_view->display('index', array( | 25 | $this->_view->display('index', array( |
28 | 'lifestyleHomePage' => true, | 26 | 'lifestyleHomePage' => true, |
29 | - 'showFooterTab'=> false, | 27 | + 'homeHeader' => array('searchUrl' => Helpers::url('/search.html', null, 'search')), |
28 | + 'showFooterTab' => false, | ||
30 | 'maybeLike' => true, | 29 | 'maybeLike' => true, |
31 | 'content' => Index\HomeModel::getLifestyleFloor(), | 30 | 'content' => Index\HomeModel::getLifestyleFloor(), |
32 | 'pageFooter' => true, | 31 | 'pageFooter' => true, |
@@ -175,6 +175,8 @@ class SearchController extends AbstractAction | @@ -175,6 +175,8 @@ class SearchController extends AbstractAction | ||
175 | */ | 175 | */ |
176 | public function searchAction() | 176 | public function searchAction() |
177 | { | 177 | { |
178 | + $data = array(); | ||
179 | + | ||
178 | if ($this->isAjax()) { | 180 | if ($this->isAjax()) { |
179 | // 过滤请求参数 | 181 | // 过滤请求参数 |
180 | $condition = filter_input_array(INPUT_GET, array( | 182 | $condition = filter_input_array(INPUT_GET, array( |
@@ -207,7 +209,6 @@ class SearchController extends AbstractAction | @@ -207,7 +209,6 @@ class SearchController extends AbstractAction | ||
207 | $type = $this->get('type', ''); | 209 | $type = $this->get('type', ''); |
208 | $order = Helpers::transOrder($orderVal, $type); | 210 | $order = Helpers::transOrder($orderVal, $type); |
209 | 211 | ||
210 | - $data = array(); | ||
211 | // 查询品类或品牌数据 | 212 | // 查询品类或品牌数据 |
212 | if (!isset($condition['query'])) { | 213 | if (!isset($condition['query'])) { |
213 | $condition['order'] = $order; | 214 | $condition['order'] = $order; |
@@ -237,14 +238,14 @@ class SearchController extends AbstractAction | @@ -237,14 +238,14 @@ class SearchController extends AbstractAction | ||
237 | } | 238 | } |
238 | $listData = array(); | 239 | $listData = array(); |
239 | } | 240 | } |
241 | + } | ||
240 | 242 | ||
241 | - if (empty($data)) { | 243 | + if (empty($data['new'])) { |
242 | echo ' '; | 244 | echo ' '; |
243 | } else { | 245 | } else { |
244 | $this->_view->display('page', $data); | 246 | $this->_view->display('page', $data); |
245 | } | 247 | } |
246 | } | 248 | } |
247 | - } | ||
248 | 249 | ||
249 | /** | 250 | /** |
250 | * Ajax异步获取筛选数据 | 251 | * Ajax异步获取筛选数据 |
@@ -252,6 +253,8 @@ class SearchController extends AbstractAction | @@ -252,6 +253,8 @@ class SearchController extends AbstractAction | ||
252 | */ | 253 | */ |
253 | public function filterAction() | 254 | public function filterAction() |
254 | { | 255 | { |
256 | + $data = array(); | ||
257 | + | ||
255 | if ($this->isAjax()) { | 258 | if ($this->isAjax()) { |
256 | // 过滤请求参数 | 259 | // 过滤请求参数 |
257 | $condition = filter_input_array(INPUT_GET, array( | 260 | $condition = filter_input_array(INPUT_GET, array( |
@@ -278,22 +281,19 @@ class SearchController extends AbstractAction | @@ -278,22 +281,19 @@ class SearchController extends AbstractAction | ||
278 | $condition['gender'] = rawurldecode($condition['gender']); | 281 | $condition['gender'] = rawurldecode($condition['gender']); |
279 | } | 282 | } |
280 | 283 | ||
281 | - $data = array(); | ||
282 | $listData = SearchData::searchByCondition($condition); | 284 | $listData = SearchData::searchByCondition($condition); |
283 | // 处理返回的数据 | 285 | // 处理返回的数据 |
284 | if (isset($listData['data']) && isset($listData['data']['filter'])) { | 286 | if (isset($listData['data']) && isset($listData['data']['filter'])) { |
285 | $data['filter'] = ListProcess::getFilterData($listData['data']['filter']); | 287 | $data['filter'] = ListProcess::getFilterData($listData['data']['filter']); |
286 | } | 288 | } |
287 | $listData = array(); | 289 | $listData = array(); |
290 | + } | ||
288 | 291 | ||
289 | if (empty($data)) { | 292 | if (empty($data)) { |
290 | echo ' '; | 293 | echo ' '; |
291 | } else { | 294 | } else { |
292 | $this->_view->display('filter', $data); | 295 | $this->_view->display('filter', $data); |
293 | } | 296 | } |
294 | - } else { | ||
295 | - echo ' '; | ||
296 | - } | ||
297 | } | 297 | } |
298 | 298 | ||
299 | /** | 299 | /** |
@@ -134,9 +134,9 @@ class ShoppingCartController extends AbstractAction | @@ -134,9 +134,9 @@ class ShoppingCartController extends AbstractAction | ||
134 | public function tplAction() | 134 | public function tplAction() |
135 | { | 135 | { |
136 | if($this->isAjax()) { | 136 | if($this->isAjax()) { |
137 | - $data = file_get_contents('../../../template/m.yohobuy.com/partials/shopping-cart/chose-panel.phtml'); | 137 | + //$data = file_get_contents('../../../template/m.yohobuy.com/partials/shopping-cart/chose-panel.phtml'); |
138 | 138 | ||
139 | - echo($data); | 139 | + //echo($data); |
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 |
@@ -54,11 +54,11 @@ class PlusstarModel | @@ -54,11 +54,11 @@ class PlusstarModel | ||
54 | $brandList = PlusstarData::firstBrandList($gender, $channel); | 54 | $brandList = PlusstarData::firstBrandList($gender, $channel); |
55 | if (!empty($brandList['recom']['data']['list'][0]['data'])) { | 55 | if (!empty($brandList['recom']['data']['list'][0]['data'])) { |
56 | $result['ps']['star'] = self::formatData($brandList['recom']['data']['list'][0]['data'], $gender, true); | 56 | $result['ps']['star'] = self::formatData($brandList['recom']['data']['list'][0]['data'], $gender, true); |
57 | - $result['leftName'] = isset($brandList['recom']['data']['brand_type_name']) ? $brandList['recom']['data']['brand_type_name'] : ''; | 57 | + //$result['ps']['sName'] = isset($brandList['recom']['data']['brand_type_name']) ? $brandList['recom']['data']['brand_type_name'] : ''; |
58 | } | 58 | } |
59 | if (!empty($brandList['all']['data']['list'][0]['data'])) { | 59 | if (!empty($brandList['all']['data']['list'][0]['data'])) { |
60 | $result['ps']['plus'] = self::formatData($brandList['all']['data']['list'][0]['data'], $gender, true); | 60 | $result['ps']['plus'] = self::formatData($brandList['all']['data']['list'][0]['data'], $gender, true); |
61 | - $result['rightName'] = isset($brandList['all']['data']['brand_type_name']) ? $brandList['all']['data']['brand_type_name'] : ''; | 61 | + //$result['ps']['pName'] = isset($brandList['all']['data']['brand_type_name']) ? $brandList['all']['data']['brand_type_name'] : ''; |
62 | } | 62 | } |
63 | 63 | ||
64 | if (USE_CACHE) { | 64 | if (USE_CACHE) { |
@@ -110,11 +110,11 @@ class PlusstarModel | @@ -110,11 +110,11 @@ class PlusstarModel | ||
110 | $brandList = PlusstarData::brandList($gender, $channel); | 110 | $brandList = PlusstarData::brandList($gender, $channel); |
111 | if (!empty($brandList['star']['data']['list'][0]['data'])) { | 111 | if (!empty($brandList['star']['data']['list'][0]['data'])) { |
112 | $result['ps']['star'] = self::formatData($brandList['star']['data']['list'][0]['data'], $gender, false); | 112 | $result['ps']['star'] = self::formatData($brandList['star']['data']['list'][0]['data'], $gender, false); |
113 | - $result['leftName'] = isset($brandList['star']['data']['brand_type_name']) ? $brandList['star']['data']['brand_type_name'] : ''; | 113 | + //$result['ps']['pName'] = isset($brandList['star']['data']['brand_type_name']) ? $brandList['star']['data']['brand_type_name'] : ''; |
114 | } | 114 | } |
115 | if (!empty($brandList['original']['data']['list'][0]['data'])) { | 115 | if (!empty($brandList['original']['data']['list'][0]['data'])) { |
116 | $result['ps']['plus'] = self::formatData($brandList['original']['data']['list'][0]['data'], $gender, true); | 116 | $result['ps']['plus'] = self::formatData($brandList['original']['data']['list'][0]['data'], $gender, true); |
117 | - $result['leftName'] = isset($brandList['original']['data']['brand_type_name']) ? $brandList['original']['data']['brand_type_name'] : ''; | 117 | + //$result['ps']['sName'] = isset($brandList['original']['data']['brand_type_name']) ? $brandList['original']['data']['brand_type_name'] : ''; |
118 | } | 118 | } |
119 | 119 | ||
120 | if (USE_CACHE) { | 120 | if (USE_CACHE) { |
@@ -59,7 +59,7 @@ class SideModel | @@ -59,7 +59,7 @@ class SideModel | ||
59 | } | 59 | } |
60 | // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 | 60 | // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 |
61 | else { | 61 | else { |
62 | - Cache::set(CacheConfig::KEY_COMMON_SIDE_NAV, $result); | 62 | + Cache::set(CacheConfig::KEY_COMMON_SIDE_NAV, $result, 3600); // 缓存1小时 |
63 | } | 63 | } |
64 | } | 64 | } |
65 | 65 |
@@ -124,7 +124,7 @@ class ListModel | @@ -124,7 +124,7 @@ class ListModel | ||
124 | $result = ListProcess::getListData($listData['data']); | 124 | $result = ListProcess::getListData($listData['data']); |
125 | if (!empty($listData['data']['brand'])) { | 125 | if (!empty($listData['data']['brand'])) { |
126 | $result['brandWay'] = array( | 126 | $result['brandWay'] = array( |
127 | - 'url' => 'http://'. $listData['data']['brand']['brand_domain'] . SUB_DOMAIN, | 127 | + 'url' => 'http://' . $listData['data']['brand']['brand_domain'] . SUB_DOMAIN, |
128 | 'thumb' => Helpers::getImageUrl($listData['data']['brand']['brand_ico'], 75, 40), | 128 | 'thumb' => Helpers::getImageUrl($listData['data']['brand']['brand_ico'], 75, 40), |
129 | 'name' => $listData['data']['brand']['brand_name'] | 129 | 'name' => $listData['data']['brand']['brand_name'] |
130 | ); | 130 | ); |
@@ -147,6 +147,52 @@ class ListModel | @@ -147,6 +147,52 @@ class ListModel | ||
147 | } | 147 | } |
148 | 148 | ||
149 | /** | 149 | /** |
150 | + * 根据品牌ID获取品牌LOGO | ||
151 | + * | ||
152 | + * @param int $id 品牌ID | ||
153 | + * @param string $title 品牌标题 | ||
154 | + * @return array | false | ||
155 | + */ | ||
156 | + public static function getBrandLogoByIds($id, &$title) | ||
157 | + { | ||
158 | + $result = false; | ||
159 | + | ||
160 | + if (USE_CACHE) { | ||
161 | + $key = CacheConfig::KEY_ACTION_PRODUCT_BRAND_INFOS . strval($id); | ||
162 | + // 先尝试获取一级缓存(master), 有数据则直接返回. | ||
163 | + $result = Cache::get($key, 'master'); | ||
164 | + if (!empty($result)) { | ||
165 | + return $result; | ||
166 | + } | ||
167 | + } | ||
168 | + | ||
169 | + // 调用接口查询数据 | ||
170 | + $brandLogo = BrandData::getBrandLogo($id); | ||
171 | + // 处理返回的数据 | ||
172 | + if (isset($brandLogo['data'][0])) { | ||
173 | + $result = array( | ||
174 | + 'url' => Helpers::url('', null, $brandLogo['data'][0]['brand_domain']), | ||
175 | + 'thumb' => Helpers::getImageUrl($brandLogo['data'][0]['brand_ico'], 75, 40), | ||
176 | + 'name' => $brandLogo['data'][0]['brand_name'], | ||
177 | + ); | ||
178 | + $title = $result['name']; | ||
179 | + } | ||
180 | + | ||
181 | + if (USE_CACHE) { | ||
182 | + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. | ||
183 | + if (empty($result)) { | ||
184 | + $result = Cache::get($key, 'slave'); | ||
185 | + } | ||
186 | + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 | ||
187 | + else { | ||
188 | + Cache::set($key, $result, 10800); // 缓存3小时 | ||
189 | + } | ||
190 | + } | ||
191 | + | ||
192 | + return $result; | ||
193 | + } | ||
194 | + | ||
195 | + /** | ||
150 | * 获取所有的品牌名称列表 | 196 | * 获取所有的品牌名称列表 |
151 | * | 197 | * |
152 | * @return array( | 198 | * @return array( |
@@ -28,6 +28,9 @@ class PlusstarController extends AbstractAction | @@ -28,6 +28,9 @@ class PlusstarController extends AbstractAction | ||
28 | 28 | ||
29 | $data = Guang\PlusstarModel::getBrands($gender); | 29 | $data = Guang\PlusstarModel::getBrands($gender); |
30 | $data['psList'] = true; // 控制模板中的JS使用 | 30 | $data['psList'] = true; // 控制模板中的JS使用 |
31 | + $data['ps']['sName'] = '明星潮品'; | ||
32 | + $data['ps']['pName'] = '原创潮牌'; | ||
33 | + $data[ 'pageFooter'] = true; | ||
31 | 34 | ||
32 | $this->_view->display('list', $data); | 35 | $this->_view->display('list', $data); |
33 | } else { | 36 | } else { |
@@ -36,8 +39,11 @@ class PlusstarController extends AbstractAction | @@ -36,8 +39,11 @@ class PlusstarController extends AbstractAction | ||
36 | 39 | ||
37 | $data = Guang\PlusstarModel::getFirstBrands($gender); | 40 | $data = Guang\PlusstarModel::getFirstBrands($gender); |
38 | $data['psList'] = true; // 控制模板中的JS使用 | 41 | $data['psList'] = true; // 控制模板中的JS使用 |
42 | + $data['ps']['sName'] = '设计师'; | ||
43 | + $data['ps']['pName'] = '经典潮牌'; | ||
44 | + $data[ 'pageFooter'] = true; | ||
39 | 45 | ||
40 | - $this->_view->display('index', $data); | 46 | + $this->_view->display('list', $data); |
41 | } | 47 | } |
42 | } | 48 | } |
43 | 49 | ||
@@ -56,6 +62,8 @@ class PlusstarController extends AbstractAction | @@ -56,6 +62,8 @@ class PlusstarController extends AbstractAction | ||
56 | 62 | ||
57 | $data = Guang\PlusstarModel::getBrands($gender); | 63 | $data = Guang\PlusstarModel::getBrands($gender); |
58 | $data['psList'] = true; // 控制模板中的JS使用 | 64 | $data['psList'] = true; // 控制模板中的JS使用 |
65 | + $data['ps']['sName'] = '明星潮品'; | ||
66 | + $data['ps']['pName'] = '原创潮牌'; | ||
59 | 67 | ||
60 | $this->_view->display('list', $data); | 68 | $this->_view->display('list', $data); |
61 | } | 69 | } |
@@ -59,6 +59,7 @@ class IndexController extends AbstractAction | @@ -59,6 +59,7 @@ class IndexController extends AbstractAction | ||
59 | 'goodListPage' => true, | 59 | 'goodListPage' => true, |
60 | 'showDownloadApp' => true, | 60 | 'showDownloadApp' => true, |
61 | 'goodList' => $condition, | 61 | 'goodList' => $condition, |
62 | + 'pageFooter' => true, | ||
62 | )); | 63 | )); |
63 | } | 64 | } |
64 | 65 | ||
@@ -77,14 +78,14 @@ class IndexController extends AbstractAction | @@ -77,14 +78,14 @@ class IndexController extends AbstractAction | ||
77 | /* 品牌域名参数 @see Bootstrap.php */ | 78 | /* 品牌域名参数 @see Bootstrap.php */ |
78 | $domain = $this->param('named'); | 79 | $domain = $this->param('named'); |
79 | if (empty($domain)) { | 80 | if (empty($domain)) { |
80 | - $this->error(); | 81 | + $this->go(SITE_MAIN); |
81 | } | 82 | } |
82 | 83 | ||
83 | /* 通过品牌域名找到对应的品牌ID */ | 84 | /* 通过品牌域名找到对应的品牌ID */ |
84 | $domainList = Product\ListModel::getAllBrandDomains(); | 85 | $domainList = Product\ListModel::getAllBrandDomains(); |
85 | $brandIds = array_keys($domainList, $domain); | 86 | $brandIds = array_keys($domainList, $domain); |
86 | if (!isset($brandIds[0])) { | 87 | if (!isset($brandIds[0])) { |
87 | - $this->error(); | 88 | + $this->go(SITE_MAIN); |
88 | } | 89 | } |
89 | 90 | ||
90 | // 当前的登录用户UID | 91 | // 当前的登录用户UID |
@@ -113,12 +114,13 @@ class IndexController extends AbstractAction | @@ -113,12 +114,13 @@ class IndexController extends AbstractAction | ||
113 | $condition['gender'] = rawurldecode($condition['gender']); | 114 | $condition['gender'] = rawurldecode($condition['gender']); |
114 | } | 115 | } |
115 | 116 | ||
117 | + $data = array(); | ||
116 | $data['goodListPage'] = true; | 118 | $data['goodListPage'] = true; |
117 | $data['showDownloadApp'] = true; | 119 | $data['showDownloadApp'] = true; |
118 | // 从搜索页过来的,显示搜索框, 和进入品牌引导信息 | 120 | // 从搜索页过来的,显示搜索框, 和进入品牌引导信息 |
119 | if ($from === 'search') { | 121 | if ($from === 'search') { |
120 | $data['goodList'] = array(); | 122 | $data['goodList'] = array(); |
121 | - $data['goodList']['brandWay'] = false; | 123 | + $data['goodList']['brandWay'] = Product\ListModel::getBrandLogoByIds($brandIds[0], $title); |
122 | $data['goodList']['search']['default'] = $query; | 124 | $data['goodList']['search']['default'] = $query; |
123 | $data['goodList']['search']['url'] = Helpers::url('', null, 'search'); | 125 | $data['goodList']['search']['url'] = Helpers::url('', null, 'search'); |
124 | } | 126 | } |
@@ -128,6 +130,7 @@ class IndexController extends AbstractAction | @@ -128,6 +130,7 @@ class IndexController extends AbstractAction | ||
128 | $data['goodList'] = array(); | 130 | $data['goodList'] = array(); |
129 | } | 131 | } |
130 | $data['goodList'] += $condition; | 132 | $data['goodList'] += $condition; |
133 | + $data['pageFooter'] = true; | ||
131 | 134 | ||
132 | if ($title === '') { | 135 | if ($title === '') { |
133 | $title = $domain; | 136 | $title = $domain; |
@@ -2,7 +2,6 @@ | @@ -2,7 +2,6 @@ | ||
2 | 2 | ||
3 | use Action\AbstractAction; | 3 | use Action\AbstractAction; |
4 | use LibModels\Wap\Product\NewsaleData; | 4 | use LibModels\Wap\Product\NewsaleData; |
5 | -use Product\NewsaleModel; | ||
6 | use Plugin\Helpers; | 5 | use Plugin\Helpers; |
7 | 6 | ||
8 | /** | 7 | /** |
@@ -22,13 +21,12 @@ class NewsaleController extends AbstractAction | @@ -22,13 +21,12 @@ class NewsaleController extends AbstractAction | ||
22 | $this->setNavHeader('新品到着'); | 21 | $this->setNavHeader('新品到着'); |
23 | 22 | ||
24 | $channel = Helpers::getChannelByCookie(); | 23 | $channel = Helpers::getChannelByCookie(); |
25 | - | ||
26 | - $data = array(); | ||
27 | - $data['newArrivalPage'] = true; | ||
28 | - $data['headerBanner'] = \Product\NewsaleModel::getNewFocus($channel); | ||
29 | // 设置一些筛选的默认参数 | 24 | // 设置一些筛选的默认参数 |
30 | - $data += array( | ||
31 | - 'showDownloadApp'=>true, | 25 | + $data = array( |
26 | + 'newArrivalPage' => true, | ||
27 | + 'showDownloadApp' => true, | ||
28 | + 'pageFooter' => true, | ||
29 | + 'headerBanner' => \Product\NewsaleModel::getNewFocus($channel), | ||
32 | 'brand' => '0', | 30 | 'brand' => '0', |
33 | 'sort' => '0', | 31 | 'sort' => '0', |
34 | 'gender' => Helpers::getGenderByCookie(), | 32 | 'gender' => Helpers::getGenderByCookie(), |
@@ -52,13 +50,12 @@ class NewsaleController extends AbstractAction | @@ -52,13 +50,12 @@ class NewsaleController extends AbstractAction | ||
52 | $this->setNavHeader('Sale'); | 50 | $this->setNavHeader('Sale'); |
53 | 51 | ||
54 | $channel = Helpers::getChannelByCookie(); | 52 | $channel = Helpers::getChannelByCookie(); |
55 | - | ||
56 | - $data = array(); | ||
57 | - $data['discountPage'] = true; | ||
58 | - $data['headerBanner'] = \Product\NewsaleModel::getNewFocus($channel); | ||
59 | - // 设置一些筛选的默认参数 | ||
60 | - $data += array( | ||
61 | - 'showDownloadApp'=>true, | 53 | + // 设置一些默认参数 |
54 | + $data = array( | ||
55 | + 'discountPage' => true, | ||
56 | + 'headerBanner' => \Product\NewsaleModel::getNewFocus($channel), | ||
57 | + 'showDownloadApp' => true, | ||
58 | + 'pageFooter' => true, | ||
62 | 'brand' => '0', | 59 | 'brand' => '0', |
63 | 'sort' => '0', | 60 | 'sort' => '0', |
64 | 'gender' => Helpers::getGenderByCookie(), | 61 | 'gender' => Helpers::getGenderByCookie(), |
@@ -77,6 +74,8 @@ class NewsaleController extends AbstractAction | @@ -77,6 +74,8 @@ class NewsaleController extends AbstractAction | ||
77 | */ | 74 | */ |
78 | public function selectNewSaleAction() | 75 | public function selectNewSaleAction() |
79 | { | 76 | { |
77 | + $result = array(); | ||
78 | + | ||
80 | if ($this->isAjax()) { | 79 | if ($this->isAjax()) { |
81 | $gender = $this->get('gender', null); | 80 | $gender = $this->get('gender', null); |
82 | $brand = $this->get('brand', null); | 81 | $brand = $this->get('brand', null); |
@@ -101,15 +100,13 @@ class NewsaleController extends AbstractAction | @@ -101,15 +100,13 @@ class NewsaleController extends AbstractAction | ||
101 | $gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order | 100 | $gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order |
102 | ); | 101 | ); |
103 | $result = \Product\NewsaleModel::selectData($data); | 102 | $result = \Product\NewsaleModel::selectData($data); |
103 | + } | ||
104 | 104 | ||
105 | if (empty($result)) { | 105 | if (empty($result)) { |
106 | echo ' '; | 106 | echo ' '; |
107 | } else { | 107 | } else { |
108 | $this->_view->display('product', $result); | 108 | $this->_view->display('product', $result); |
109 | } | 109 | } |
110 | - } else { | ||
111 | - echo ' '; | ||
112 | - } | ||
113 | } | 110 | } |
114 | 111 | ||
115 | /** | 112 | /** |
@@ -119,6 +116,8 @@ class NewsaleController extends AbstractAction | @@ -119,6 +116,8 @@ class NewsaleController extends AbstractAction | ||
119 | */ | 116 | */ |
120 | public function filterAction() | 117 | public function filterAction() |
121 | { | 118 | { |
119 | + $result = array(); | ||
120 | + | ||
122 | if ($this->isAjax()) { | 121 | if ($this->isAjax()) { |
123 | $gender = $this->get('gender', null); | 122 | $gender = $this->get('gender', null); |
124 | $brand = $this->get('brand', null); | 123 | $brand = $this->get('brand', null); |
@@ -142,15 +141,13 @@ class NewsaleController extends AbstractAction | @@ -142,15 +141,13 @@ class NewsaleController extends AbstractAction | ||
142 | $gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order | 141 | $gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order |
143 | ); | 142 | ); |
144 | $result = \Product\NewsaleModel::filterData($data); | 143 | $result = \Product\NewsaleModel::filterData($data); |
144 | + } | ||
145 | 145 | ||
146 | if (empty($result)) { | 146 | if (empty($result)) { |
147 | echo ' '; | 147 | echo ' '; |
148 | } else { | 148 | } else { |
149 | $this->_view->display('filter', $result); | 149 | $this->_view->display('filter', $result); |
150 | } | 150 | } |
151 | - } else { | ||
152 | - echo ' '; | ||
153 | - } | ||
154 | } | 151 | } |
155 | 152 | ||
156 | } | 153 | } |
-
Please register or login to post a comment