Authored by yangyang

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into feature/web-list

@@ -39,7 +39,7 @@ class BrandData @@ -39,7 +39,7 @@ class BrandData
39 $param['client_secret'] = Sign::getSign($param); 39 $param['client_secret'] = Sign::getSign($param);
40 40
41 $cache = empty($uid) ? 3600 : false; 41 $cache = empty($uid) ? 3600 : false;
42 - 42 +
43 return Yohobuy::get(Yohobuy::API_URL, $param, $cache); // 有缓存1小时 43 return Yohobuy::get(Yohobuy::API_URL, $param, $cache); // 有缓存1小时
44 } 44 }
45 45
@@ -55,7 +55,7 @@ class BrandData @@ -55,7 +55,7 @@ class BrandData
55 $param['brand_id'] = $brandId; 55 $param['brand_id'] = $brandId;
56 $param['method'] = 'app.brand.banner'; 56 $param['method'] = 'app.brand.banner';
57 $param['client_secret'] = Sign::getSign($param); 57 $param['client_secret'] = Sign::getSign($param);
58 - 58 +
59 return Yohobuy::get(Yohobuy::API_URL, $param, 3600); // 有缓存1小时 59 return Yohobuy::get(Yohobuy::API_URL, $param, 3600); // 有缓存1小时
60 } 60 }
61 61
@@ -66,10 +66,10 @@ class BrandData @@ -66,10 +66,10 @@ class BrandData
66 * @return array 66 * @return array
67 */ 67 */
68 public static function getBrandLogo($brandId) 68 public static function getBrandLogo($brandId)
69 - {  
70 - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByids', array($brandId )); 69 + {
  70 + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByids', array($brandId));
71 } 71 }
72 - 72 +
73 /** 73 /**
74 * 通过域名获取品牌LOGO信息 74 * 通过域名获取品牌LOGO信息
75 * 75 *
@@ -78,9 +78,9 @@ class BrandData @@ -78,9 +78,9 @@ class BrandData
78 */ 78 */
79 public static function getBrandLogoByDomain($domain) 79 public static function getBrandLogoByDomain($domain)
80 { 80 {
81 - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByDomain', array($domain )); 81 + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByDomain', array($domain));
82 } 82 }
83 - 83 +
84 /** 84 /**
85 * 通过品牌id获取品牌Folder 85 * 通过品牌id获取品牌Folder
86 * 86 *
@@ -88,19 +88,49 @@ class BrandData @@ -88,19 +88,49 @@ class BrandData
88 * @param int $status 状态 88 * @param int $status 状态
89 * @return array 89 * @return array
90 */ 90 */
91 - public static function getFolderByBrand($brand_id,$status = 1) 91 + public static function getFolderByBrand($brand_id, $status = 1)
92 { 92 {
93 - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_FOLDER, 'getFolderByBrand', array($brand_id,$status )); 93 + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_FOLDER, 'getFolderByBrand', array($brand_id, $status));
94 } 94 }
95 - 95 +
96 /** 96 /**
97 * 根据节点和运行模式选择静态内容 97 * 根据节点和运行模式选择静态内容
98 * @param $node 20141219-100447 98 * @param $node 20141219-100447
99 * @param string $mode 99 * @param string $mode
100 * @return mixed 100 * @return mixed
101 */ 101 */
102 - public static function getByNodeContent($node, $mode='release') 102 + public static function getByNodeContent($node, $mode = 'release')
103 { 103 {
104 return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_NODECONTENT, 'getByNodeContent', array($node, $mode)); 104 return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_NODECONTENT, 'getByNodeContent', array($node, $mode));
105 } 105 }
  106 +
  107 + /*
  108 + * 品牌一览资源位banner
  109 + * @param string $contentCode 获取广告资源需要的位置码
  110 + * @param int $channel 频道标识 1:男,2:女,3:潮童,4:创意生活
  111 + * @return array(
  112 + * "brandTop": "顶部的轮翻广告及热门品牌数据",
  113 + * "brandList": "按字母'A-Z'分组的品牌列表数据"
  114 + * )
  115 + */
  116 +
  117 + public static function getTopBanner($contentCode,$channel)
  118 + {
  119 + /* 顶部的轮翻广告及热门品牌数据 */
  120 + $param = Yohobuy::param();
  121 + $param['content_code'] = $contentCode;
  122 + $param['client_secret'] = Sign::getSign($param);
  123 + $urlList['brandTop'] = Yohobuy::httpBuildQuery(Yohobuy::SERVICE_URL . self::URI_BRAND_TOPPOS, $param);
  124 +
  125 + /* 按字母"A-Z"分组的品牌列表数据 */
  126 + $param = Yohobuy::param();
  127 + $param['method'] = 'app.brand.brandlist';
  128 + $param['yh_channel'] = $channel;
  129 + $param['client_secret'] = Sign::getSign($param);
  130 + $urlList['brandList'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
  131 +
  132 + return Yohobuy::getMulti($urlList, array(), 3600); // 有缓存1小时
  133 + }
  134 +
  135 +
106 } 136 }
@@ -35,20 +35,22 @@ class Cache @@ -35,20 +35,22 @@ class Cache
35 */ 35 */
36 public static function set($key, $value, $expire = 3600) 36 public static function set($key, $value, $expire = 3600)
37 { 37 {
38 - try {  
39 - // WINDOWS  
40 - if (DIRECTORY_SEPARATOR === '\\') {  
41 - HoodCache::Memcache('master')->set(self::makeKey($key, 'master'), $value, $expire);  
42 - HoodCache::Memcache('slave')->set(self::makeKey($key, 'slave'), $value, 86400); // 二级缓存1天  
43 - }  
44 - // LINUX  
45 - else {  
46 - HoodCache::Memcached('master')->set(self::makeKey($key, 'master'), $value, $expire);  
47 - HoodCache::Memcached('slave')->set(self::makeKey($key, 'slave'), $value, 86400); // 二级缓存1天  
48 - }  
49 - } catch (Exception $e) {  
50 - // do nothing  
51 - } 38 + if(USE_CACHE) {
  39 + try {
  40 + // WINDOWS
  41 + if (DIRECTORY_SEPARATOR === '\\') {
  42 + HoodCache::Memcache('master')->set(self::makeKey($key, 'master'), $value, $expire);
  43 + HoodCache::Memcache('slave')->set(self::makeKey($key, 'slave'), $value, 86400); // 二级缓存1天
  44 + }
  45 + // LINUX
  46 + else {
  47 + HoodCache::Memcached('master')->set(self::makeKey($key, 'master'), $value, $expire);
  48 + HoodCache::Memcached('slave')->set(self::makeKey($key, 'slave'), $value, 86400); // 二级缓存1天
  49 + }
  50 + } catch (Exception $e) {
  51 + // do nothing
  52 + }
  53 + }
52 } 54 }
53 55
54 /** 56 /**
@@ -61,20 +63,20 @@ class Cache @@ -61,20 +63,20 @@ class Cache
61 public static function get($key, $node = 'master') 63 public static function get($key, $node = 'master')
62 { 64 {
63 $result = array(); 65 $result = array();
64 -  
65 - try {  
66 - // WINDOWS  
67 - if (DIRECTORY_SEPARATOR === '\\') {  
68 - $result = HoodCache::Memcache($node)->get(self::makeKey($key, $node));  
69 - }  
70 - // LINUX  
71 - else {  
72 - $result = HoodCache::Memcached($node)->get(self::makeKey($key, $node));  
73 - }  
74 - } catch (Exception $e) {  
75 - $result = array(); 66 + if(USE_CACHE) {
  67 + try {
  68 + // WINDOWS
  69 + if (DIRECTORY_SEPARATOR === '\\') {
  70 + $result = HoodCache::Memcache($node)->get(self::makeKey($key, $node));
  71 + }
  72 + // LINUX
  73 + else {
  74 + $result = HoodCache::Memcached($node)->get(self::makeKey($key, $node));
  75 + }
  76 + } catch (Exception $e) {
  77 + $result = array();
  78 + }
76 } 79 }
77 -  
78 return $result; 80 return $result;
79 } 81 }
80 82
@@ -86,16 +88,18 @@ class Cache @@ -86,16 +88,18 @@ class Cache
86 */ 88 */
87 public static function delete($key) 89 public static function delete($key)
88 { 90 {
89 - // WINDOWS  
90 - if (DIRECTORY_SEPARATOR === '\\') {  
91 - HoodCache::Memcache('master')->delete(self::makeKey($key, 'master'));  
92 - HoodCache::Memcache('slave')->delete(self::makeKey($key, 'slave'));  
93 - }  
94 - // LINUX  
95 - else {  
96 - HoodCache::Memcached('master')->delete(self::makeKey($key, 'master'));  
97 - HoodCache::Memcached('slave')->delete(self::makeKey($key, 'slave'));  
98 - } 91 + if(USE_CACHE) {
  92 + // WINDOWS
  93 + if (DIRECTORY_SEPARATOR === '\\') {
  94 + HoodCache::Memcache('master')->delete(self::makeKey($key, 'master'));
  95 + HoodCache::Memcache('slave')->delete(self::makeKey($key, 'slave'));
  96 + }
  97 + // LINUX
  98 + else {
  99 + HoodCache::Memcached('master')->delete(self::makeKey($key, 'master'));
  100 + HoodCache::Memcached('slave')->delete(self::makeKey($key, 'slave'));
  101 + }
  102 + }
99 } 103 }
100 104
101 /** 105 /**
@@ -292,7 +292,7 @@ class HelperSearch @@ -292,7 +292,7 @@ class HelperSearch
292 { 292 {
293 $result = array(); 293 $result = array();
294 $options = self::$options; 294 $options = self::$options;
295 - if (!isset($options['controller']) || $options['controller'] == 'Search') { 295 + if (!isset($options['controller']) || $options['controller'] != 'Search') {
296 return $result; 296 return $result;
297 } 297 }
298 $params = self::$params; 298 $params = self::$params;
@@ -31,7 +31,11 @@ var _hmt = _hmt || []; @@ -31,7 +31,11 @@ var _hmt = _hmt || [];
31 s.parentNode.insertBefore(hm, s); 31 s.parentNode.insertBefore(hm, s);
32 })(); 32 })();
33 } 33 }
34 - window.addEventListener('load', async_load, false); 34 + if (window.addEventListener) {
  35 + window.addEventListener(type, async_load, false);
  36 + } else if (window.attachEvent) {
  37 + window.attachEvent("on" + type, async_load);
  38 + }
35 })(); 39 })();
36 </script> 40 </script>
37 <script> 41 <script>
@@ -48,4 +52,4 @@ var _hmt = _hmt || []; @@ -48,4 +52,4 @@ var _hmt = _hmt || [];
48 var h = d.getElementsByTagName("script")[0];h.parentNode.insertBefore(c, h); 52 var h = d.getElementsByTagName("script")[0];h.parentNode.insertBefore(c, h);
49 }(document); 53 }(document);
50 </script> 54 </script>
51 -<script src="http://static.yohobuy.com/js/v3/o_code.js?v=20150420" async="async"></script>  
  55 +<script src="http://static.yohobuy.com/js/v3/o_code.js?v=20150420" async="async"></script>
@@ -162,7 +162,7 @@ $('.logo-brand').logoBrand({ @@ -162,7 +162,7 @@ $('.logo-brand').logoBrand({
162 $.ajax({ 162 $.ajax({
163 type: 'GET', 163 type: 'GET',
164 dataType: 'json', 164 dataType: 'json',
165 - url: '/hotrank/getdata', 165 + url: '/product/index/getdata',
166 data: param, 166 data: param,
167 success: function(res) { 167 success: function(res) {
168 var data; 168 var data;
@@ -289,6 +289,7 @@ @@ -289,6 +289,7 @@
289 289
290 .senior { 290 .senior {
291 padding-bottom: 6px; 291 padding-bottom: 6px;
  292 + padding-right: 0;
292 293
293 .attr-content { 294 .attr-content {
294 position: relative; 295 position: relative;
@@ -242,11 +242,14 @@ class DetailModel @@ -242,11 +242,14 @@ class DetailModel
242 ++ $i; 242 ++ $i;
243 } 243 }
244 // 遍历所有颜色, 构建尺码显示数据 244 // 遍历所有颜色, 构建尺码显示数据
  245 + $i = 1;
245 foreach ($colorList as $value) { 246 foreach ($colorList as $value) {
246 // 各个尺码的颜色,每行显示一个颜色的对应尺码 247 // 各个尺码的颜色,每行显示一个颜色的对应尺码
247 - $sizeGroup[]['size'] = $sizeList[ $value['skcId'] ]; 248 + $sizeGroup[$i]['size'] = $sizeList[ $value['skcId'] ];
248 // 默认颜色 249 // 默认颜色
249 $colorGroup[0]['color'][] = $value; 250 $colorGroup[0]['color'][] = $value;
  251 +
  252 + ++ $i;
250 } 253 }
251 254
252 // 商品图: 多个 255 // 商品图: 多个
@@ -275,6 +278,8 @@ class DetailModel @@ -275,6 +278,8 @@ class DetailModel
275 $notForSale = $baseInfo['attribute'] == 2; 278 $notForSale = $baseInfo['attribute'] == 2;
276 // 显示加入购物车链接 279 // 显示加入购物车链接
277 if (!$soldOut && !$notForSale) { 280 if (!$soldOut && !$notForSale) {
  281 + ksort($colorGroup, SORT_NUMERIC);
  282 +
278 $result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html'); 283 $result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html');
279 $result['cartInfo']['productId'] = $productId; 284 $result['cartInfo']['productId'] = $productId;
280 $result['cartInfo']['thumbs'] = $thumbImageList; 285 $result['cartInfo']['thumbs'] = $thumbImageList;
1 <?php 1 <?php
2 -use Action\AbstractAction; 2 +
  3 +use Action\WebAction;
  4 +use Product\BrandsModel;
3 5
4 /** 6 /**
5 * 品牌首页 7 * 品牌首页
6 */ 8 */
7 -class BrandsController extends AbstractAction 9 +class BrandsController extends WebAction
8 { 10 {
9 11
10 public function brandsAction() 12 public function brandsAction()
11 { 13 {
12 - $headerdata = array(  
13 - 'gobytype' => 'gobuyboys',  
14 - 'searchcate' => 'searchcateboys',  
15 - 'navbars' => array(  
16 - array(  
17 - 'name_cn' => '男生',  
18 - 'name_en' => 'BOYS',  
19 - 'link' => '',  
20 - 'classname' => 'boys',  
21 - 'index_main' => 0,  
22 - 'subnav' => array(  
23 - array(  
24 - 'name' => '男首1',  
25 - 'link' => '',  
26 - 'index_sub' => 0,  
27 - 'thirdnav' => array(  
28 - array(  
29 - 'title' => '上装',  
30 - 'branditems' => array(  
31 - array(  
32 - 'brandname' => '背心',  
33 - 'link' => ''  
34 - ),  
35 - array(  
36 - 'brandname' => 'T恤',  
37 - 'link' => ''  
38 - )  
39 - )  
40 - )  
41 -  
42 - )  
43 - ),  
44 - array(  
45 - 'name' => '男首2',  
46 - 'link' => '',  
47 - 'index_sub' => 1,  
48 - 'thirdnav' => array(  
49 - array(  
50 - 'title' => '上装',  
51 - 'branditems' => array(  
52 - array(  
53 - 'brandname' => '背心',  
54 - 'link' => ''  
55 - ),  
56 - array(  
57 - 'brandname' => 'T恤',  
58 - 'link' => ''  
59 - )  
60 - )  
61 - )  
62 - )  
63 - ),  
64 - array(  
65 - 'name' => '男首3',  
66 - 'link' => '',  
67 - 'index_sub' => 2,  
68 - 'thirdnav' => array(  
69 - array(  
70 - 'title' => '上装',  
71 - 'branditems' => array(  
72 - array(  
73 - 'brandname' => '背心',  
74 - 'link' => ''  
75 - ),  
76 - array(  
77 - 'brandname' => 'T恤',  
78 - 'link' => ''  
79 - )  
80 - )  
81 - )  
82 - )  
83 - )  
84 - )  
85 - ),  
86 - array(  
87 - 'name_cn' => '女生',  
88 - 'name_en' => 'GIRLS',  
89 - 'link' => 'http=>//www.baidu.com',  
90 - 'classname' => '',  
91 - 'index_main' => 0,  
92 - 'subnav' => array(  
93 - array(  
94 - 'name' => '女生1',  
95 - 'link' => '',  
96 - 'index_sub' => 0,  
97 - 'thirdnav' => array(  
98 - array(  
99 - 'title' => '上装',  
100 - 'branditems' => array(  
101 - array(  
102 - 'brandname' => '背心',  
103 - 'link' => ''  
104 - ),  
105 - array(  
106 - 'brandname' => 'T恤',  
107 - 'link' => ''  
108 - )  
109 - )  
110 - )  
111 - )  
112 - ),  
113 - array(  
114 - 'name' => '女生2',  
115 - 'link' => '',  
116 - 'index_sub' => 1,  
117 - 'thirdnav' => array(  
118 - array(  
119 - 'title' => '上装',  
120 - 'branditems' => array(  
121 - array(  
122 - 'brandname' => '背心',  
123 - 'link' => ''  
124 - ),  
125 - array(  
126 - 'brandname' => 'T恤',  
127 - 'link' => ''  
128 - )  
129 - )  
130 - )  
131 - )  
132 - ),  
133 - array(  
134 - 'name' => '女生3',  
135 - 'link' => '',  
136 - 'index_sub' => 2,  
137 - 'thirdnav' => array(  
138 - array(  
139 - 'title' => '上装',  
140 - 'branditems' => array(  
141 - array(  
142 - 'brandname' => '背心',  
143 - 'link' => ''  
144 - ),  
145 - array(  
146 - 'brandname' => 'T恤',  
147 - 'link' => ''  
148 - )  
149 - )  
150 - )  
151 - )  
152 - )  
153 - )  
154 - )  
155 - ),  
156 - 'myyoho' => array(  
157 - 'email' => 'hhh@126.com',  
158 - 'viptype' => '普通会员',  
159 - 'currentscore' => 495,  
160 - 'totalscore' => 600,  
161 - 'cardtype' => '银卡',  
162 - 'infolist' => array(  
163 - array(  
164 - 'name' => '待处理的订单',  
165 - 'link' => '',  
166 - 'num' => '0'  
167 - ),  
168 - array(  
169 - 'name' => '我的收藏',  
170 - 'link' => '',  
171 - 'num' => '1'  
172 - ),  
173 - array(  
174 - 'name' => '我的优惠券',  
175 - 'link' => '',  
176 - 'num' => '2'  
177 - ),  
178 - array(  
179 - 'name' => '我的YOHO币',  
180 - 'link' => '',  
181 - 'num' => '1'  
182 - ),  
183 - array(  
184 - 'name' => '我的退货换货',  
185 - 'link' => '',  
186 - 'num' => '1'  
187 - )  
188 - ),  
189 - 'updlink' => ''  
190 - ),  
191 - 'gobuy' => array(  
192 - 'gobuynum' => 3  
193 - ),  
194 - 'breadcrumbnav' => array(  
195 - array(  
196 - 'notend' => array(  
197 - 'link' => 'http=>//www.baidu.com',  
198 - 'name' => 'BOYS首页'  
199 - )  
200 - ),  
201 - array(  
202 - 'notend' => array(  
203 - 'link' => 'http=>//www.baidu.com',  
204 - 'name' => '上衣'  
205 - )  
206 - ),  
207 - array(  
208 - 'isend' => array(  
209 - 'link' => 'http=>//www.baidu.com',  
210 - 'name' => '衬衫'  
211 - )  
212 - )  
213 - )  
214 - );  
215 -  
216 - $imgsrc = 'http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg';  
217 - $item = array(  
218 - 'name' => 'cc',  
219 - 'key' => '1000011'  
220 - );  
221 - $item0 = array(  
222 - 'name' => 'cc',  
223 - 'hot' => 'hot',  
224 - 'key' => '1000012'  
225 - );  
226 -  
227 - $item1 = array(  
228 - 'name' => '所有品牌',  
229 - 'src' => $imgsrc,  
230 - 'url' => ''  
231 - );  
232 - $item2 = array(  
233 - 'name' => '所有品牌',  
234 - 'src' => $imgsrc,  
235 - 'url' => '',  
236 - 'items' => array(  
237 - $item1,  
238 - $item1,  
239 - $item1,  
240 - $item1,  
241 - $item1,  
242 - $item1,  
243 - $item1,  
244 - $item1,  
245 - $item1,  
246 - $item1  
247 - )  
248 - );  
249 - 14 + //品牌一览头部
  15 + $channel = $this->getCookie("_Channel") ? $this->getCookie("_Channel") : 'boys';
  16 + $this->setWebNavHeader($channel);
  17 +
  18 + //banner-list
  19 + $res = BrandsModel::getBrandView($channel);
  20 +
  21 + //数据整合
250 $data = array( 22 $data = array(
251 'brandsHomePage' => true, 23 'brandsHomePage' => true,
252 - 'headerdata' => $headerdata,  
253 'brands' => array( 24 'brands' => array(
254 - 'category' => array(  
255 - 'A' => array(  
256 - $item,  
257 - $item,  
258 - $item,  
259 - $item,  
260 - $item,  
261 - $item,  
262 - $item,  
263 - $item,  
264 - $item  
265 - ),  
266 - 'B' => array(  
267 - $item,  
268 - $item,  
269 - $item0,  
270 - $item,  
271 - $item,  
272 - $item,  
273 - $item,  
274 - $item,  
275 - $item  
276 - ),  
277 - 'C' => array(  
278 - $item,  
279 - $item,  
280 - $item,  
281 - $item,  
282 - $item,  
283 - $item,  
284 - $item,  
285 - $item,  
286 - $item  
287 - ),  
288 - 'D' => array(  
289 - $item,  
290 - $item,  
291 - $item,  
292 - $item,  
293 - $item,  
294 - $item,  
295 - $item,  
296 - $item,  
297 - $item,  
298 - $item,  
299 - $item0,  
300 - $item,  
301 - $item,  
302 - $item,  
303 - $item,  
304 - $item,  
305 - $item,  
306 - $item,  
307 - $item,  
308 - $item,  
309 - $item,  
310 - $item,  
311 - $item,  
312 - $item,  
313 - $item  
314 - ),  
315 - 'E' => array(  
316 - $item,  
317 - $item,  
318 - $item0,  
319 - $item,  
320 - $item,  
321 - $item,  
322 - $item,  
323 - $item,  
324 - $item  
325 - ),  
326 - 'F' => array(  
327 - $item0,  
328 - $item,  
329 - $item,  
330 - $item0,  
331 - $item0,  
332 - $item,  
333 - $item0,  
334 - $item,  
335 - $item  
336 - ),  
337 - 'G' => array(  
338 - $item,  
339 - $item,  
340 - $item,  
341 - $item,  
342 - $item,  
343 - $item0,  
344 - $item,  
345 - $item,  
346 - $item  
347 - ),  
348 - 'H' => array(  
349 - $item,  
350 - $item,  
351 - $item,  
352 - $item,  
353 - $item,  
354 - $item,  
355 - $item0,  
356 - $item,  
357 - $item  
358 - ),  
359 - 'I' => array(  
360 - $item,  
361 - $item,  
362 - $item0,  
363 - $item0,  
364 - $item0,  
365 - $item0,  
366 - $item,  
367 - $item,  
368 - $item  
369 - ),  
370 - 'J' => array(  
371 - $item,  
372 - $item,  
373 - $item,  
374 - $item,  
375 - $item0,  
376 - $item,  
377 - $item,  
378 - $item,  
379 - $item  
380 - ),  
381 - 'K' => array(  
382 - $item,  
383 - $item,  
384 - $item,  
385 - $item,  
386 - $item,  
387 - $item,  
388 - $item,  
389 - $item,  
390 - $item  
391 - ),  
392 - 'L' => array(  
393 - $item,  
394 - $item0,  
395 - $item,  
396 - $item,  
397 - $item,  
398 - $item,  
399 - $item,  
400 - $item,  
401 - $item  
402 - ),  
403 - 'M' => array(  
404 - $item,  
405 - $item0,  
406 - $item,  
407 - $item,  
408 - $item,  
409 - $item,  
410 - $item,  
411 - $item,  
412 - $item  
413 - ),  
414 - 'N' => array(  
415 - $item,  
416 - $item0,  
417 - $item0,  
418 - $item0,  
419 - $item,  
420 - $item,  
421 - $item,  
422 - $item,  
423 - $item  
424 - )  
425 - ),  
426 - 'tabs' => array(  
427 - $item2,  
428 - $item2,  
429 - $item2,  
430 - $item2,  
431 - $item2  
432 - ) 25 + 'category' => $res['brandList'],
  26 + 'tabs' => $res['brandTop']
433 ) 27 )
434 ); 28 );
435 -  
436 $this->_view->display('brands', $data); 29 $this->_view->display('brands', $data);
437 } 30 }
438 31
@@ -446,39 +39,26 @@ class BrandsController extends AbstractAction @@ -446,39 +39,26 @@ class BrandsController extends AbstractAction
446 public function brandinfoAction() 39 public function brandinfoAction()
447 { 40 {
448 $result = array(); 41 $result = array();
449 - 42 +
450 do { 43 do {
451 /* 判断是不是AJAX请求 */ 44 /* 判断是不是AJAX请求 */
452 - if (! $this->isAjax()) { 45 + if (!$this->isAjax()) {
453 break; 46 break;
454 } 47 }
  48 + $brandId = $this->get('brandId',0);
  49 + $uid=$this->getUid(false);
  50 + $brandId=144;
  51 + BrandsModel::getBrandInfo($brandId, $uid);
  52 +
  53 +
455 54
456 - $imgsrc = 'http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg';  
457 - $data = array(  
458 - 'key' => '1000011',  
459 - 'icon' => $imgsrc,  
460 - 'title' => '优显led触控台灯',  
461 - 'content' => '优显led触控台灯优显led触控台灯优显led触控台灯优显led触控台灯',  
462 - 'subtitle' => 'AAAAAA',  
463 - 'imgs' => array(  
464 - array(  
465 - 'src' => $imgsrc  
466 - ),  
467 - array(  
468 - 'src' => $imgsrc  
469 - ),  
470 - array(  
471 - 'src' => $imgsrc  
472 - )  
473 - )  
474 - ) // 提示  
475 -;  
476 $result = array( 55 $result = array(
477 'code' => 200, 56 'code' => 200,
478 'brand' => $data 57 'brand' => $data
479 ); 58 );
480 - } while (false);  
481 - 59 + }
  60 + while (false);
  61 +
482 $this->echoJson($result); 62 $this->echoJson($result);
483 } 63 }
484 64
@@ -516,7 +96,6 @@ class BrandsController extends AbstractAction @@ -516,7 +96,6 @@ class BrandsController extends AbstractAction
516 ) 96 )
517 ) 97 )
518 ) 98 )
519 -  
520 ) 99 )
521 ), 100 ),
522 array( 101 array(
@@ -700,7 +279,7 @@ class BrandsController extends AbstractAction @@ -700,7 +279,7 @@ class BrandsController extends AbstractAction
700 'src' => $imgsrc, 279 'src' => $imgsrc,
701 'name' => '优显led触控台灯' 280 'name' => '优显led触控台灯'
702 ); 281 );
703 - 282 +
704 $data = array( 283 $data = array(
705 'brandsHomePage' => true, 284 'brandsHomePage' => true,
706 'headerdata' => $headerdata, 285 'headerdata' => $headerdata,
@@ -982,7 +561,6 @@ class BrandsController extends AbstractAction @@ -982,7 +561,6 @@ class BrandsController extends AbstractAction
982 ) 561 )
983 ) 562 )
984 ) 563 )
985 -  
986 ) 564 )
987 ), 565 ),
988 array( 566 array(
@@ -1157,7 +735,7 @@ class BrandsController extends AbstractAction @@ -1157,7 +735,7 @@ class BrandsController extends AbstractAction
1157 ) 735 )
1158 ); 736 );
1159 $imgsrc = 'http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg'; 737 $imgsrc = 'http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg';
1160 - 738 +
1161 $item1 = array( 739 $item1 = array(
1162 'name' => '所有品牌', 740 'name' => '所有品牌',
1163 'src' => $imgsrc, 741 'src' => $imgsrc,
@@ -1170,7 +748,7 @@ class BrandsController extends AbstractAction @@ -1170,7 +748,7 @@ class BrandsController extends AbstractAction
1170 'name' => 'Millefed', 748 'name' => 'Millefed',
1171 'desc' => ' I.T于2006年冬季在香港推出最新品牌创始 人Shawn Stussy将滑板服、工作服、旧校 服的设计加入到 ' 749 'desc' => ' I.T于2006年冬季在香港推出最新品牌创始 人Shawn Stussy将滑板服、工作服、旧校 服的设计加入到 '
1172 ); 750 );
1173 - 751 +
1174 $data = array( 752 $data = array(
1175 'brandsHomePage' => true, 753 'brandsHomePage' => true,
1176 'headerdata' => $headerdata, 754 'headerdata' => $headerdata,
@@ -1196,4 +774,5 @@ class BrandsController extends AbstractAction @@ -1196,4 +774,5 @@ class BrandsController extends AbstractAction
1196 ); 774 );
1197 $this->_view->display('list', $data); 775 $this->_view->display('list', $data);
1198 } 776 }
1199 -}  
  777 +
  778 +}
@@ -5,6 +5,7 @@ namespace Product; @@ -5,6 +5,7 @@ namespace Product;
5 use Api\Yohobuy; 5 use Api\Yohobuy;
6 use Plugin\HelperSearch; 6 use Plugin\HelperSearch;
7 use LibModels\Web\Product\BrandData; 7 use LibModels\Web\Product\BrandData;
  8 +use Index\HomeModel;
8 use Product\SearchModel; 9 use Product\SearchModel;
9 10
10 /** 11 /**
@@ -12,35 +13,41 @@ use Product\SearchModel; @@ -12,35 +13,41 @@ use Product\SearchModel;
12 * 13 *
13 * @author Administrator 14 * @author Administrator
14 */ 15 */
15 -class BrandsModel 16 +class BrandsModel
16 { 17 {
  18 +
  19 + //品牌一览资源位CODE码
  20 + const BOYS_BRAND_CODE = '8b16b7baf9a66fbe553a6caa97d2ce2a';
  21 + const GIRLS_BRAND_CODE = 'c95ae9e40f0add10549b819f821ad626';
  22 + const KIDS_BRAND_CODE = '84b7926282fdef92f1039bdcf77c18ba';
  23 + const LIFESTYLE_BRAND_CODE = 'c575c6bfdfa4125fae7d24bbec7119c8';
  24 +
17 /** 25 /**
18 * 搜索品牌数据 26 * 搜索品牌数据
19 * @param $condition array 搜索数据的条件 27 * @param $condition array 搜索数据的条件
20 * @param $options array 28 * @param $options array
21 * @return array 29 * @return array
22 */ 30 */
23 - public static function getBrandSearchData($condition, $options) 31 + public static function getBrandSearchData($condition, $options)
24 { 32 {
25 // 并行调用品牌相关接口并封装数据 33 // 并行调用品牌相关接口并封装数据
26 $data = self::getBrandData($condition, $options); 34 $data = self::getBrandData($condition, $options);
27 - 35 +
28 //获取品牌系列数据 36 //获取品牌系列数据
29 $adNav = self::getAdNav($options['brandId']); 37 $adNav = self::getAdNav($options['brandId']);
30 $data['leftContent'][] = array('picLink' => $adNav); 38 $data['leftContent'][] = array('picLink' => $adNav);
31 - 39 +
32 //获取静态内容(eg:20141219-100447) 40 //获取静态内容(eg:20141219-100447)
33 - if($options['node']){ 41 + if ($options['node']) {
34 $nodeContent = HelperSearch::formatNodeContent($options['node']); 42 $nodeContent = HelperSearch::formatNodeContent($options['node']);
35 $data['leftContent'][]['picLink']['list'] = $nodeContent; 43 $data['leftContent'][]['picLink']['list'] = $nodeContent;
36 } 44 }
37 - 45 +
38 return $data; 46 return $data;
39 } 47 }
40 -  
41 48
42 //获取品牌系列数据 49 //获取品牌系列数据
43 - public static function getAdNav($brandId, $status = 1) 50 + public static function getAdNav($brandId, $status = 1)
44 { 51 {
45 //调用接口获得数据 52 //调用接口获得数据
46 $advNav = BrandData::getFolderByBrand($brandId, $status); 53 $advNav = BrandData::getFolderByBrand($brandId, $status);
@@ -52,7 +59,7 @@ class BrandsModel @@ -52,7 +59,7 @@ class BrandsModel
52 } 59 }
53 $result['picTitle'] = '经典系列'; 60 $result['picTitle'] = '经典系列';
54 } 61 }
55 - 62 +
56 return $result; 63 return $result;
57 } 64 }
58 65
@@ -65,32 +72,151 @@ class BrandsModel @@ -65,32 +72,151 @@ class BrandsModel
65 public static function getBrandData($customCondition = array(), $customOptions = array()) 72 public static function getBrandData($customCondition = array(), $customOptions = array())
66 { 73 {
67 $urlList = array(); 74 $urlList = array();
68 - 75 +
69 //获取$condition和$option 筛选条件和排序条件 76 //获取$condition和$option 筛选条件和排序条件
70 $searchCondition = SearchModel::searchCondition($customCondition, $customOptions); 77 $searchCondition = SearchModel::searchCondition($customCondition, $customOptions);
71 - 78 +
72 // 组合搜索商品url 79 // 组合搜索商品url
73 $urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']); 80 $urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']);
74 - 81 +
75 // 组合搜索分类url 82 // 组合搜索分类url
76 $urlList['sort'] = HelperSearch::getClassesUrl($searchCondition['condition']); 83 $urlList['sort'] = HelperSearch::getClassesUrl($searchCondition['condition']);
77 - 84 +
78 //组合搜索品牌url 85 //组合搜索品牌url
79 $urlList['brand'] = HelperSearch::getBrandUrl($customOptions); 86 $urlList['brand'] = HelperSearch::getBrandUrl($customOptions);
80 - 87 +
81 //组合获取品牌banner url 88 //组合获取品牌banner url
82 $urlList['banner'] = HelperSearch::getBannerUrl($customOptions); 89 $urlList['banner'] = HelperSearch::getBannerUrl($customOptions);
83 - 90 +
84 //组合用户浏览记录url 91 //组合用户浏览记录url
85 //$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']); 92 //$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);
86 -  
87 //批量调接口 93 //批量调接口
88 $result = Yohobuy::getMulti($urlList, array(), true); 94 $result = Yohobuy::getMulti($urlList, array(), true);
89 - 95 +
90 //组织模板数据格式 96 //组织模板数据格式
91 $data = HelperSearch::getList($result, $searchCondition['options']); 97 $data = HelperSearch::getList($result, $searchCondition['options']);
92 -  
93 - 98 +
  99 +
94 return $data; 100 return $data;
95 } 101 }
  102 +
  103 + /*
  104 + * 获取品牌一览页面,品牌top & 列表
  105 + */
  106 +
  107 + public static function getBrandView($channel)
  108 + {
  109 + $switchParams = self::switchBrandParams($channel);
  110 + $brandTop = array();
  111 + /*
  112 + * $item1 = array(
  113 + 'name' => '所有品牌',
  114 + 'src' => $imgsrc,
  115 + 'url' => ''
  116 + );
  117 + */
  118 + $brandAds = array();
  119 + $brandList = array();
  120 + $res = BrandData::getTopBanner($switchParams['brandCode'], $switchParams['channelType']);
  121 + if (isset($res['brandTop'][0]['data']) && $res['brandTop'][0]['data']) {
  122 + foreach ($res['brandTop'][0]['data'] as $tk => $tv) {
  123 + $imgUrl = explode("?", $tv['src']);
  124 + $topTmp = array(
  125 + 'name' => $tv['title'],
  126 + 'src' => $imgUrl[0],
  127 + 'url' => $tv['url'],
  128 + 'items' => array()
  129 + );
  130 + $brandTop[$tk] = $topTmp;
  131 + }
  132 + }
  133 + if (isset($res['brandList']['brands']) && $res['brandList']['brands']) {
  134 + foreach ($res['brandList']['brands'] as $lk => $lv) {
  135 + if (isset($lv) && $lv) {
  136 + $listTmp = array();
  137 + foreach ($lv as $ltk => $ltv) {
  138 + $listTmp[$ltk] = array(
  139 + 'name' => $ltv['brand_name'],
  140 + 'key' => $ltv['id']
  141 + );
  142 + if ($ltv['is_hot'] == 'Y') {
  143 + $listTmp[$ltk] += array('hot' => 'hot');
  144 + }
  145 + }
  146 + }
  147 + $brandList[$lk] = $listTmp;
  148 + }
  149 + }
  150 + return array(
  151 + 'brandTop' => $brandTop,
  152 + 'brandList' => $brandList
  153 + );
  154 + }
  155 +
  156 + /*
  157 + * 获取单个广告浮窗内容
  158 + */
  159 + public static function getBrandInfo($brandId, $uid)
  160 + {
  161 + $imgsrc = 'http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg';
  162 + $data = array(
  163 + 'key' => '1000011',
  164 + 'icon' => $imgsrc,
  165 + 'title' => '优显led触控台灯',
  166 + 'content' => '优显led触控台灯优显led触控台灯优显led触控台灯优显led触控台灯',
  167 + 'subtitle' => 'AAAAAA',
  168 + 'imgs' => array(
  169 + array(
  170 + 'src' => $imgsrc
  171 + ),
  172 + array(
  173 + 'src' => $imgsrc
  174 + ),
  175 + array(
  176 + 'src' => $imgsrc
  177 + )
  178 + )
  179 + );
  180 + $res = BrandData::getBrandIntro($brandId, $uid);
  181 +//if(isset($res['data']) && $res['data']){
  182 +// $data['key']=$brandId;
  183 +// $data['icon']=
  184 +//}
  185 + var_dump($res);
  186 + die();
  187 +
  188 + }
  189 +
  190 + /*
  191 + * 获取品牌一览资源位&channelType
  192 + */
  193 +
  194 + public static function switchBrandParams($channelStr = 'boys')
  195 + {
  196 + $res = array('channelType' => 1, 'brandCode' => self::BOYS_BRAND_CODE);
  197 + switch ($channelStr) {
  198 + case HomeModel::COOKIE_NAME_BOYS:
  199 + $res['channelType'] = 1;
  200 + $res['brandCode'] = self::BOYS_BRAND_CODE;
  201 + break;
  202 + case HomeModel::COOKIE_NAME_GIRLS:
  203 + $res['channelType'] = 2;
  204 + $res['brandCode'] = self::GIRLS_BRAND_CODE;
  205 + break;
  206 + case HomeModel::COOKIE_NAME_KIDS:
  207 + $res['channelType'] = 3;
  208 + $res['brandCode'] = self::KIDS_BRAND_CODE;
  209 + break;
  210 + case HomeModel::COOKIE_NAME_LIFESTYLE:
  211 + $res['channelType'] = 4;
  212 + $res['brandCode'] = self::LIFESTYLE_BRAND_CODE;
  213 + break;
  214 + default:
  215 + $res['channelType'] = 1;
  216 + $res['brandCode'] = self::BOYS_BRAND_CODE;
  217 + break;
  218 + }
  219 + return $res;
  220 + }
  221 +
96 } 222 }
@@ -150,7 +150,7 @@ class SearchModel @@ -150,7 +150,7 @@ class SearchModel
150 // 组合搜索折扣区间url 150 // 组合搜索折扣区间url
151 $urlList['discount'] = HelperSearch::getDiscountUrl($searchCondition['condition']); 151 $urlList['discount'] = HelperSearch::getDiscountUrl($searchCondition['condition']);
152 // 组合搜索最新上架url 152 // 组合搜索最新上架url
153 - $urlList['recent'] = HelperSearch::getRecentShelveUrl($searchCondition['condition']); 153 + //$urlList['recent'] = HelperSearch::getRecentShelveUrl($searchCondition['condition']);
154 //用户浏览记录 154 //用户浏览记录
155 //$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']); 155 //$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);
156 156
1 <?php 1 <?php
2 2
3 -use Action\AbstractAction; 3 +use Action\WebAction;
4 use LibModels\Web\Passport\LoginData; 4 use LibModels\Web\Passport\LoginData;
5 use Plugin\Helpers; 5 use Plugin\Helpers;
6 use Plugin\Partner\Factory; 6 use Plugin\Partner\Factory;
7 7
8 -class AutosignController extends AbstractAction 8 +class AutosignController extends WebAction
9 { 9 {
10 10
11 /** 11 /**
1 <?php 1 <?php
2 2
3 -use Action\AbstractAction; 3 +use Action\WebAction;
4 use LibModels\Web\Passport\RegData; 4 use LibModels\Web\Passport\RegData;
5 use LibModels\Wap\Passport\BindData; 5 use LibModels\Wap\Passport\BindData;
6 use Passport\PassportModel as PassportModel; 6 use Passport\PassportModel as PassportModel;
7 use Plugin\Helpers; 7 use Plugin\Helpers;
8 8
9 -class AutouserinfoController extends AbstractAction 9 +class AutouserinfoController extends WebAction
10 { 10 {
11 11
12 /** 12 /**