Authored by hf

fixes bug refs YW-905 YW864

framework @ 75bbc3b0
1 -Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05 1 +Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
@@ -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 /**
@@ -201,5 +201,16 @@ class BrandData @@ -201,5 +201,16 @@ class BrandData
201 201
202 return Yohobuy::get(Yohobuy::API_URL, $param); 202 return Yohobuy::get(Yohobuy::API_URL, $param);
203 } 203 }
  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 + }
204 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 - $result['like'] = array();  
250 - $result['like']['count'] = $articleData['praise_num'];  
251 - $result['like']['isLiked'] = isset($articleData['isPraise']) && $articleData['isPraise'] === 'Y'; 249 +
252 // 收藏 250 // 收藏
253 - // $result['collect'] = array();  
254 - // $result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y'; 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 {
  258 + $result['like'] = array();
  259 + $result['like']['count'] = $articleData['praise_num'];
  260 + $result['like']['isLiked'] = isset($articleData['isPraise']) && $articleData['isPraise'] === '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 // 判断是否显示作者信息
@@ -16,50 +16,43 @@ class BoysController extends AbstractAction @@ -16,50 +16,43 @@ class BoysController extends AbstractAction
16 { 16 {
17 // 设置COOKIE标识用户访问过该页面了 17 // 设置COOKIE标识用户访问过该页面了
18 Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_BOYS); 18 Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_BOYS);
19 - 19 +
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);  
54 -  
55 - if($bottomBanner)  
56 - {  
57 - $this->echoJson($bottomBanner); 48 + $bottomBanner = Index\HomeModel::getBottomBanner($channel);
  49 + if (empty($bottomBanner)) {
  50 + break;
58 } 51 }
59 - }  
60 - while(false);  
61 -  
62 - echo ' '; 52 +
  53 + $this->echoJson($bottomBanner);
  54 +
  55 + } while (false);
63 } 56 }
64 57
65 } 58 }
@@ -16,49 +16,43 @@ class GirlsController extends AbstractAction @@ -16,49 +16,43 @@ class GirlsController extends AbstractAction
16 { 16 {
17 // 设置COOKIE标识用户访问过该页面了 17 // 设置COOKIE标识用户访问过该页面了
18 Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_GIRLS); 18 Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_GIRLS);
19 - 19 +
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);  
53 -  
54 - if($bottomBanner)  
55 - {  
56 - $this->echoJson($bottomBanner); 48 + $bottomBanner = Index\HomeModel::getBottomBanner($channel);
  49 + if (empty($bottomBanner)) {
  50 + break;
57 } 51 }
58 - }  
59 - while(false);  
60 -  
61 - echo ' '; 52 +
  53 + $this->echoJson($bottomBanner);
  54 +
  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,
@@ -90,11 +90,11 @@ class SearchController extends AbstractAction @@ -90,11 +90,11 @@ 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 }
@@ -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,12 +238,12 @@ class SearchController extends AbstractAction @@ -237,12 +238,12 @@ class SearchController extends AbstractAction
237 } 238 }
238 $listData = array(); 239 $listData = array();
239 } 240 }
  241 + }
240 242
241 - if (empty($data)) {  
242 - echo ' ';  
243 - } else {  
244 - $this->_view->display('page', $data);  
245 - } 243 + if (empty($data['new'])) {
  244 + echo ' ';
  245 + } else {
  246 + $this->_view->display('page', $data);
246 } 247 }
247 } 248 }
248 249
@@ -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,21 +281,18 @@ class SearchController extends AbstractAction @@ -278,21 +281,18 @@ 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)) {  
290 - echo ' ';  
291 - } else {  
292 - $this->_view->display('filter', $data);  
293 - }  
294 - } else { 292 + if (empty($data)) {
295 echo ' '; 293 echo ' ';
  294 + } else {
  295 + $this->_view->display('filter', $data);
296 } 296 }
297 } 297 }
298 298
@@ -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
@@ -100,6 +100,8 @@ class BrandModel @@ -100,6 +100,8 @@ class BrandModel
100 } 100 }
101 } 101 }
102 102
  103 + $result['pageFooter'] = true;
  104 +
103 $brand = array(); 105 $brand = array();
104 106
105 return $result; 107 return $result;
@@ -176,6 +176,9 @@ class IndexModel @@ -176,6 +176,9 @@ class IndexModel
176 } 176 }
177 } 177 }
178 178
  179 + // 显示底部
  180 + $data['pageFooter'] = true;
  181 +
179 $category = array(); 182 $category = array();
180 $article = array(); 183 $article = array();
181 184
@@ -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
@@ -44,7 +44,7 @@ class ListModel @@ -44,7 +44,7 @@ class ListModel
44 } 44 }
45 45
46 // 调用接口查询数据 46 // 调用接口查询数据
47 - $listData = ClassData::filterClassData($condition); 47 + $listData = ClassData::filterClassData($condition);
48 // 处理返回的数据 48 // 处理返回的数据
49 if (isset($listData['code']) && $listData['code'] === 200) { 49 if (isset($listData['code']) && $listData['code'] === 200) {
50 $result = ListProcess::getListData($listData['data']); 50 $result = ListProcess::getListData($listData['data']);
@@ -86,7 +86,7 @@ class ListModel @@ -86,7 +86,7 @@ class ListModel
86 } 86 }
87 87
88 // 获取品牌banner的数据, 有缓存1小时 88 // 获取品牌banner的数据, 有缓存1小时
89 - $bannerData = BrandData::getBrandBanner($id); 89 + $bannerData = BrandData::getBrandBanner($id);
90 if (isset($bannerData['data']['banner'])) { 90 if (isset($bannerData['data']['banner'])) {
91 $result['banner'] = Helpers::getImageUrl($bannerData['data']['banner'], 640, 75); 91 $result['banner'] = Helpers::getImageUrl($bannerData['data']['banner'], 640, 75);
92 } 92 }
@@ -118,13 +118,13 @@ class ListModel @@ -118,13 +118,13 @@ class ListModel
118 } 118 }
119 119
120 // 调用接口查询数据 120 // 调用接口查询数据
121 - $listData = BrandData::filterBrandData($condition); 121 + $listData = BrandData::filterBrandData($condition);
122 // 处理返回的数据 122 // 处理返回的数据
123 if (isset($listData['code']) && $listData['code'] === 200) { 123 if (isset($listData['code']) && $listData['code'] === 200) {
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(
@@ -25,19 +25,25 @@ class PlusstarController extends AbstractAction @@ -25,19 +25,25 @@ class PlusstarController extends AbstractAction
25 if ($type == '2') { 25 if ($type == '2') {
26 $this->setTitle('明星原创'); 26 $this->setTitle('明星原创');
27 $this->setNavHeader('明星原创', true, SITE_MAIN); 27 $this->setNavHeader('明星原创', true, SITE_MAIN);
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 - 31 + $data['ps']['sName'] = '明星潮品';
  32 + $data['ps']['pName'] = '原创潮牌';
  33 + $data[ 'pageFooter'] = true;
  34 +
32 $this->_view->display('list', $data); 35 $this->_view->display('list', $data);
33 } else { 36 } else {
34 $this->setTitle('国际优选'); 37 $this->setTitle('国际优选');
35 $this->setNavHeader('国际优选', true, SITE_MAIN); 38 $this->setNavHeader('国际优选', true, SITE_MAIN);
36 - 39 +
37 $data = Guang\PlusstarModel::getFirstBrands($gender); 40 $data = Guang\PlusstarModel::getFirstBrands($gender);
38 $data['psList'] = true; // 控制模板中的JS使用 41 $data['psList'] = true; // 控制模板中的JS使用
39 -  
40 - $this->_view->display('index', $data); 42 + $data['ps']['sName'] = '设计师';
  43 + $data['ps']['pName'] = '经典潮牌';
  44 + $data[ 'pageFooter'] = true;
  45 +
  46 + $this->_view->display('list', $data);
41 } 47 }
42 } 48 }
43 49
@@ -51,11 +57,13 @@ class PlusstarController extends AbstractAction @@ -51,11 +57,13 @@ class PlusstarController extends AbstractAction
51 { 57 {
52 $this->setTitle('明星原创'); 58 $this->setTitle('明星原创');
53 $this->setNavHeader('明星原创', true, SITE_MAIN); 59 $this->setNavHeader('明星原创', true, SITE_MAIN);
54 - 60 +
55 $gender = $this->get('gender', '1,3'); 61 $gender = $this->get('gender', '1,3');
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 }
@@ -84,7 +92,7 @@ class PlusstarController extends AbstractAction @@ -84,7 +92,7 @@ class PlusstarController extends AbstractAction
84 break; 92 break;
85 } 93 }
86 $brandId = $brandInfo['getBrandInfo']['data']['brand_id']; 94 $brandId = $brandInfo['getBrandInfo']['data']['brand_id'];
87 - 95 +
88 /* 获取更多品牌的链接 */ 96 /* 获取更多品牌的链接 */
89 $url = '/brands'; 97 $url = '/brands';
90 $brandDomains = Product\ListModel::getAllBrandDomains(); 98 $brandDomains = Product\ListModel::getAllBrandDomains();
@@ -92,7 +100,7 @@ class PlusstarController extends AbstractAction @@ -92,7 +100,7 @@ class PlusstarController extends AbstractAction
92 // 构建成 品牌域名.xxx.com 100 // 构建成 品牌域名.xxx.com
93 $url = Helpers::url('', null, $brandDomains[$brandId]); 101 $url = Helpers::url('', null, $brandDomains[$brandId]);
94 } 102 }
95 - 103 +
96 $data['psDetail'] = true; 104 $data['psDetail'] = true;
97 $data['ps']['id'] = $brandId; 105 $data['ps']['id'] = $brandId;
98 $data['ps']['banner'] = Helpers::getImageUrl($brandInfo['getBrandInfo']['data']['cover_img'], 640, 309); 106 $data['ps']['banner'] = Helpers::getImageUrl($brandInfo['getBrandInfo']['data']['cover_img'], 640, 309);
@@ -102,7 +110,7 @@ class PlusstarController extends AbstractAction @@ -102,7 +110,7 @@ class PlusstarController extends AbstractAction
102 $data['ps']['likeUrl'] = false; //"http://guang.m.yohobuy.com/plustar/brandinfo?id=285&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo","param":{"id":285}},"requesturl":{"url":"\/guang\/api\/v1\/favorite\/togglebrand","param":{"brand_id":"701"}},"priority":"Y"}}"; 110 $data['ps']['likeUrl'] = false; //"http://guang.m.yohobuy.com/plustar/brandinfo?id=285&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo","param":{"id":285}},"requesturl":{"url":"\/guang\/api\/v1\/favorite\/togglebrand","param":{"brand_id":"701"}},"priority":"Y"}}";
103 $data['ps']['intro'] = empty($brandInfo['getBrandInfo']['data']['brand_intro']) ? '' : strtr(strip_tags($brandInfo['getBrandInfo']['data']['brand_intro']), array(' ' => ' ')); 111 $data['ps']['intro'] = empty($brandInfo['getBrandInfo']['data']['brand_intro']) ? '' : strtr(strip_tags($brandInfo['getBrandInfo']['data']['brand_intro']), array(' ' => ' '));
104 $data['ps']['newArrival'] = array(); 112 $data['ps']['newArrival'] = array();
105 - $data['ps']['newArrival']['moreUrl'] = $url; 113 + $data['ps']['newArrival']['moreUrl'] = $url;
106 $data['ps']['newArrival']['naList'] = $brandInfo['getNewProduct']; 114 $data['ps']['newArrival']['naList'] = $brandInfo['getNewProduct'];
107 $data['ps']['infos'] = array(); 115 $data['ps']['infos'] = array();
108 116
@@ -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,14 +100,12 @@ class NewsaleController extends AbstractAction @@ -101,14 +100,12 @@ 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)) {  
106 - echo ' ';  
107 - } else {  
108 - $this->_view->display('product', $result);  
109 - }  
110 - } else { 105 + if (empty($result)) {
111 echo ' '; 106 echo ' ';
  107 + } else {
  108 + $this->_view->display('product', $result);
112 } 109 }
113 } 110 }
114 111
@@ -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,14 +141,12 @@ class NewsaleController extends AbstractAction @@ -142,14 +141,12 @@ 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)) {  
147 - echo ' ';  
148 - } else {  
149 - $this->_view->display('filter', $result);  
150 - }  
151 - } else { 146 + if (empty($result)) {
152 echo ' '; 147 echo ' ';
  148 + } else {
  149 + $this->_view->display('filter', $result);
153 } 150 }
154 } 151 }
155 152