Authored by whb

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

@@ -191,19 +191,19 @@ class HelperSearch @@ -191,19 +191,19 @@ class HelperSearch
191 $isSale = false; 191 $isSale = false;
192 } 192 }
193 $gender = 0; 193 $gender = 0;
194 - if (isset(self::$options['gender'])) {  
195 - $genderArr = explode(',', self::$options['gender']); 194 + if (isset(self::$params['gender'])) {
  195 + $genderArr = explode(',', self::$params['gender']);
196 $gender = $genderArr[0]; 196 $gender = $genderArr[0];
197 } 197 }
198 foreach($val['goods_list'] as $k => $v){ 198 foreach($val['goods_list'] as $k => $v){
199 $goods_list[$k]['url'] = Helpers::getUrlBySkc($val['product_id'], $v['goods_id'], $val['cn_alphabet']); 199 $goods_list[$k]['url'] = Helpers::getUrlBySkc($val['product_id'], $v['goods_id'], $val['cn_alphabet']);
200 - //女封  
201 - if (isset($v['cover_1']) && $gender == 1) {  
202 - $val['default_images'] = $v['images_url'];  
203 - }  
204 //男封 200 //男封
205 - if (isset($v['cover_2']) && $gender == 2) {  
206 - $val['default_images'] = $v['images_url']; 201 + if (isset($v['cover_1']) && !empty($v['cover_1']) && $gender == 1) {
  202 + $val['default_images'] = $v['cover_1'];
  203 + }
  204 + //女封
  205 + if (isset($v['cover_2']) && !empty($v['cover_2']) && $gender == 2) {
  206 + $val['default_images'] = $v['cover_2'];
207 } 207 }
208 //筛选符合颜色条件的封面图片 208 //筛选符合颜色条件的封面图片
209 if (isset($params['color']) && $params['color'] == $v['color_id']) { 209 if (isset($params['color']) && $params['color'] == $v['color_id']) {
@@ -232,6 +232,10 @@ class HelperSearch @@ -232,6 +232,10 @@ class HelperSearch
232 'thumb' => $val['default_images'], 232 'thumb' => $val['default_images'],
233 'name' => $val['product_name'], 233 'name' => $val['product_name'],
234 'salePrice' => $val['sales_price'], 234 'salePrice' => $val['sales_price'],
  235 + 'brand' => array(
  236 + 'url' => Helpers::url('', '', $val['brand_domain']),
  237 + 'name' => $val['brand_name']
  238 + ),
235 'isFew' => $isFew, 239 'isFew' => $isFew,
236 'skn' => $val['product_skn'], 240 'skn' => $val['product_skn'],
237 'showColBtn' => true, 241 'showColBtn' => true,
@@ -492,7 +496,7 @@ class HelperSearch @@ -492,7 +496,7 @@ class HelperSearch
492 $existName[] = $v['brand_name']; 496 $existName[] = $v['brand_name'];
493 } 497 }
494 if ($existBrandNum === 1){ 498 if ($existBrandNum === 1){
495 - $existName[]= substr($v['brand_name'], 0, 3).'...'; 499 + $existName[]= substr($v['brand_name'], 0, 4).'...';
496 } 500 }
497 $existBrandNum++; 501 $existBrandNum++;
498 } 502 }
@@ -547,9 +551,30 @@ class HelperSearch @@ -547,9 +551,30 @@ class HelperSearch
547 if (self::checkSearch('brand')) { 551 if (self::checkSearch('brand')) {
548 return array(); 552 return array();
549 } 553 }
550 - //品牌数量小于等于10,隐藏更多按钮  
551 - $result['showMulti'] = count($result['brandsShow']) > 1 ? true :false;  
552 - $result['showMore'] = count($result['brandsShow']) > 10 ? true :false; 554 + //品牌数量等于1,设置为已选中
  555 + $totalBrand = count($result['brandsShow']);
  556 + if ($totalBrand == 1) {
  557 + if (!in_array($totalBrand, $brandIds)) {
  558 + //设置已选中
  559 + self::$selected['brand'] = array(
  560 + 'name' => $result['brandsShow'][0]['name'],
  561 + 'href' => self::buildUrl($params, array('brand', $result['brandsShow'][0]['href']))
  562 + );
  563 + $result['default'][0]['checked'] = true;
  564 + }
  565 + if (self::$options['controller'] == 'Search') {
  566 + return array();
  567 + }
  568 + }
  569 + //品牌数量大于1小于10,显示多选
  570 + elseif ($totalBrand > 1 && $totalBrand < 10) {
  571 + $result['showMulti'] = true;
  572 + }
  573 + //品牌数量大于10,显示多选、更多按钮
  574 + else {
  575 + $result['showMulti'] = true;
  576 + $result['showMore'] = true;
  577 + }
553 return $result; 578 return $result;
554 } 579 }
555 /** 580 /**
@@ -1380,7 +1405,12 @@ class HelperSearch @@ -1380,7 +1405,12 @@ class HelperSearch
1380 $action = isset(self::$options['action']) ? strtolower(self::$options['action']) : ''; 1405 $action = isset(self::$options['action']) ? strtolower(self::$options['action']) : '';
1381 //列表页面 1406 //列表页面
1382 if ($controller == 'list' && $action == 'index') { 1407 if ($controller == 'list' && $action == 'index') {
1383 - $type = isset(self::$params['msort']) && self::$params['msort'] ? self::$params['msort'] : ''; 1408 + if (isset(self::$params['misort'])) {
  1409 + $type = self::$params['misort'];
  1410 + }
  1411 + elseif (isset(self::$params['msort'])) {
  1412 + $type = self::$params['msort'];
  1413 + }
1384 } 1414 }
1385 //新品到着 1415 //新品到着
1386 elseif ($controller == 'list' && $action == 'new') { 1416 elseif ($controller == 'list' && $action == 'new') {
@@ -85,4 +85,5 @@ @@ -85,4 +85,5 @@
85 {{/ newArrivls}} 85 {{/ newArrivls}}
86 {{/ boys}} 86 {{/ boys}}
87 </div> 87 </div>
  88 +<script>__custom = {"yopid":"index"};</script>
88 {{> layout/footer}} 89 {{> layout/footer}}
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> 2 <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
3 <script> 3 <script>
4 var _hmt = _hmt || []; 4 var _hmt = _hmt || [];
  5 +var _gaq = _gaq || [];
5 (function() { 6 (function() {
6 function async_load(){ 7 function async_load(){
7 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 8 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
@@ -10,6 +11,14 @@ var _hmt = _hmt || []; @@ -10,6 +11,14 @@ var _hmt = _hmt || [];
10 '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 11 '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
11 })(window,document,'script','dataLayer','GTM-W958MG'); 12 })(window,document,'script','dataLayer','GTM-W958MG');
12 (function() { 13 (function() {
  14 + _gaq.push(['_setAccount', 'UA-48997038-32']);
  15 + _gaq.push(['_trackPageview']);
  16 + var ga = document.createElement('script');
  17 + ga.type = 'text/javascript'; ga.async = true;
  18 + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  19 + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  20 + })();
  21 + (function() {
13 var hm = document.createElement("script"); 22 var hm = document.createElement("script");
14 hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311"; 23 hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311";
15 hm.async = 1; 24 hm.async = 1;
@@ -30,6 +39,17 @@ var _hmt = _hmt || []; @@ -30,6 +39,17 @@ var _hmt = _hmt || [];
30 var s = document.getElementsByTagName("script")[0]; 39 var s = document.getElementsByTagName("script")[0];
31 s.parentNode.insertBefore(hm, s); 40 s.parentNode.insertBefore(hm, s);
32 })(); 41 })();
  42 + (function() {
  43 + var hm = document.createElement("script");
  44 + hm.src = "http://static.criteo.net/js/ld/ld.js";
  45 + hm.async = 1;
  46 + var s = document.getElementsByTagName("script")[0];
  47 + s.parentNode.insertBefore(hm, s);
  48 + var u = _ozuid || "";
  49 + u = (u == 0) ? "" : u;
  50 + window.criteo_q = window.criteo_q || [];
  51 + window.criteo_q.push({event: "setAccount", account: 16184 },{event: "setCustomerId", id: u},{event: "setSiteType", type: "d" },{event: "viewHome" });
  52 + })();
33 } 53 }
34 if (window.addEventListener) { 54 if (window.addEventListener) {
35 window.addEventListener('load', async_load, false); 55 window.addEventListener('load', async_load, false);
@@ -10,6 +10,8 @@ @@ -10,6 +10,8 @@
10 <title>{{title}}</title> 10 <title>{{title}}</title>
11 <link rel="dns-prefetch" href="//cdn.yoho.cn"> 11 <link rel="dns-prefetch" href="//cdn.yoho.cn">
12 <link rel="dns-prefetch" href="//static.yohobuy.com"> 12 <link rel="dns-prefetch" href="//static.yohobuy.com">
  13 + <link rel="dns-prefetch" href="//img10.static.yhbimg.com">
  14 + <link rel="dns-prefetch" href="//img11.static.yhbimg.com">
13 <link rel="dns-prefetch" href="//img12.static.yhbimg.com"> 15 <link rel="dns-prefetch" href="//img12.static.yhbimg.com">
14 <link rel="dns-prefetch" href="//img13.static.yhbimg.com"> 16 <link rel="dns-prefetch" href="//img13.static.yhbimg.com">
15 {{#if rlsEnv}} 17 {{#if rlsEnv}}
@@ -273,7 +273,7 @@ @@ -273,7 +273,7 @@
273 \{\{/need_pay_gifts\}\} 273 \{\{/need_pay_gifts\}\}
274 </ul> 274 </ul>
275 <ul class="activity-list"> 275 <ul class="activity-list">
276 - \{{#equalone has_promotion\}\} 276 + \{{#if has_promotion\}\}
277 <li class="activity-item"> 277 <li class="activity-item">
278 <span class="activity-name">活动</span> 278 <span class="activity-name">活动</span>
279 <h3 class="activity-content"> 279 <h3 class="activity-content">
@@ -286,13 +286,13 @@ @@ -286,13 +286,13 @@
286 \{\{/equalone\}\} 286 \{\{/equalone\}\}
287 </h3> 287 </h3>
288 </li> 288 </li>
289 - \{\{/equalone\}\}  
290 - \{\{#equalone fit_free_shipping \}\} 289 + \{\{/if\}\}
  290 + \{\{#if fit_free_shipping \}\}
291 <li class="activity-item"> 291 <li class="activity-item">
292 <span class="activity-name">免运费</span> 292 <span class="activity-name">免运费</span>
293 <h3 class="activity-content">全场满 499免运费</h3> 293 <h3 class="activity-content">全场满 499免运费</h3>
294 </li> 294 </li>
295 - \{\{/equalone\}\} 295 + \{\{/if\}\}
296 </ul> 296 </ul>
297 </div> 297 </div>
298 <div class="gobuy-notempty-footer"> 298 <div class="gobuy-notempty-footer">
@@ -317,7 +317,7 @@ @@ -317,7 +317,7 @@
317 <span class="has">\{\{vip.curYearCost\}\}</span> 317 <span class="has">\{\{vip.curYearCost\}\}</span>
318 <span class="total">\{\{vip.nextVipInfo.needCost\}\}</span> 318 <span class="total">\{\{vip.nextVipInfo.needCost\}\}</span>
319 </div> 319 </div>
320 - <p class="\{\{#equalzero it.vip.curYearCostPer\}\}integrate\{\{/equalzero\}\}" style="width: \{\{vip.curYearCostPer\}\}%;"></p> 320 + <p class="\{\{#unless vip.curYearCostPer\}\}integrate\{\{/unless\}\}" style="width: \{\{vip.curYearCostPer\}\}%;"></p>
321 </div> 321 </div>
322 <span class="cardcate float-left">\{\{vip.nextVipInfo.title\}\}</span> 322 <span class="cardcate float-left">\{\{vip.nextVipInfo.title\}\}</span>
323 </div> 323 </div>
@@ -360,5 +360,6 @@ @@ -360,5 +360,6 @@
360 </div> 360 </div>
361 </script> 361 </script>
362 </div> 362 </div>
  363 +<input id="api-domain" type="hidden" value="{{apiDomain}}">
363 {{/headerdata}} 364 {{/headerdata}}
364 365
@@ -3,43 +3,39 @@ @@ -3,43 +3,39 @@
3 </script> 3 </script>
4 {{!-- 正常头部 --}} 4 {{!-- 正常头部 --}}
5 {{#headerdata}} 5 {{#headerdata}}
6 - <script> 6 +<script>
7 seajs.use('js/header'); 7 seajs.use('js/header');
8 - </script> 8 +</script>
9 {{/headerdata}} 9 {{/headerdata}}
10 {{!-- 简单头部 --}} 10 {{!-- 简单头部 --}}
11 {{#simpleHeader}} 11 {{#simpleHeader}}
12 - <script> 12 +<script>
13 seajs.use('js/simple-header'); 13 seajs.use('js/simple-header');
14 - </script> 14 +</script>
15 {{/simpleHeader}} 15 {{/simpleHeader}}
16 {{!-- 首页 --}} 16 {{!-- 首页 --}}
17 {{#if boysHomePage}} 17 {{#if boysHomePage}}
18 - <script> 18 +<script>
19 seajs.use('js/home/home'); 19 seajs.use('js/home/home');
20 - </script> 20 +</script>
21 {{/if}} 21 {{/if}}
22 -  
23 {{!-- 搜索 --}} 22 {{!-- 搜索 --}}
24 {{#if searchListPage}} 23 {{#if searchListPage}}
25 - <script> 24 +<script>
26 seajs.use('js/product/brand'); 25 seajs.use('js/product/brand');
27 seajs.use(['js/product/list', 'js/product/product'], function (list, product) { 26 seajs.use(['js/product/list', 'js/product/product'], function (list, product) {
28 -  
29 product.init(5); 27 product.init(5);
30 window.onresize = function () { 28 window.onresize = function () {
31 setTimeout(function () { 29 setTimeout(function () {
32 product.init(5); 30 product.init(5);
33 }, 300); 31 }, 300);
34 }; 32 };
35 -  
36 }); 33 });
37 - </script> 34 +</script>
38 {{/if}} 35 {{/if}}
39 -  
40 {{!-- 列表 --}} 36 {{!-- 列表 --}}
41 {{#if productListPage}} 37 {{#if productListPage}}
42 - <script> 38 +<script>
43 seajs.use(['js/product/list', 'js/product/product'], function (list, product) { 39 seajs.use(['js/product/list', 'js/product/product'], function (list, product) {
44 40
45 product.init(4); 41 product.init(4);
@@ -50,98 +46,84 @@ @@ -50,98 +46,84 @@
50 }; 46 };
51 47
52 }); 48 });
53 - </script> 49 +</script>
54 {{/if}} 50 {{/if}}
55 -  
56 {{!-- 商品详情页 --}} 51 {{!-- 商品详情页 --}}
57 {{#if productDetailPage}} 52 {{#if productDetailPage}}
58 - <script> 53 +<script>
59 seajs.use('js/product/item'); 54 seajs.use('js/product/item');
60 - </script> 55 +</script>
61 {{/if}} 56 {{/if}}
62 -  
63 {{!-- 逛 --}} 57 {{!-- 逛 --}}
64 {{#if guangIndexPage}} 58 {{#if guangIndexPage}}
65 - <script> 59 +<script>
66 seajs.use('js/guang/index'); 60 seajs.use('js/guang/index');
67 - </script> 61 +</script>
68 {{/if}} 62 {{/if}}
69 -  
70 {{!-- 逛详情页 --}} 63 {{!-- 逛详情页 --}}
71 {{#if guangDetailPage}} 64 {{#if guangDetailPage}}
72 - <script> 65 +<script>
73 seajs.use('js/guang/detail'); 66 seajs.use('js/guang/detail');
74 - </script> 67 +</script>
75 {{/if}} 68 {{/if}}
76 -  
77 {{!-- 逛列表页 --}} 69 {{!-- 逛列表页 --}}
78 {{#if guangListPage}} 70 {{#if guangListPage}}
79 - <script> 71 +<script>
80 seajs.use('js/guang/list'); 72 seajs.use('js/guang/list');
81 - </script> 73 +</script>
82 {{/if}} 74 {{/if}}
83 -  
84 {{!-- SALE --}} 75 {{!-- SALE --}}
85 {{#if saleIndexPage}} 76 {{#if saleIndexPage}}
86 - <script> 77 +<script>
87 seajs.use('js/sale/index'); 78 seajs.use('js/sale/index');
88 - </script> 79 +</script>
89 {{/if}} 80 {{/if}}
90 -  
91 {{!-- sale列表 --}} 81 {{!-- sale列表 --}}
92 {{#if saleListPage}} 82 {{#if saleListPage}}
93 <script> 83 <script>
94 seajs.use(['js/product/list', 'js/product/product', 'js/sale/banner'], function (list, product) { 84 seajs.use(['js/product/list', 'js/product/product', 'js/sale/banner'], function (list, product) {
95 -  
96 product.init(4); 85 product.init(4);
97 window.onresize = function () { 86 window.onresize = function () {
98 setTimeout(function () { 87 setTimeout(function () {
99 product.init(4); 88 product.init(4);
100 }, 300); 89 }, 300);
101 }; 90 };
102 -  
103 }); 91 });
104 </script> 92 </script>
105 {{/if}} 93 {{/if}}
106 -  
107 {{!-- sale 分类列表 --}} 94 {{!-- sale 分类列表 --}}
108 {{#if saleCatPage}} 95 {{#if saleCatPage}}
109 <script> 96 <script>
110 seajs.use(['js/product/list', 'js/product/product', 'js/sale/banner'], function (list, product) { 97 seajs.use(['js/product/list', 'js/product/product', 'js/sale/banner'], function (list, product) {
111 -  
112 product.init(4); 98 product.init(4);
113 window.onresize = function () { 99 window.onresize = function () {
114 setTimeout(function () { 100 setTimeout(function () {
115 product.init(4); 101 product.init(4);
116 }, 300); 102 }, 300);
117 }; 103 };
118 -  
119 }); 104 });
120 </script> 105 </script>
121 {{/if}} 106 {{/if}}
122 -  
123 {{!-- 登录注册找回密码--}} 107 {{!-- 登录注册找回密码--}}
124 {{#if loginPage}} 108 {{#if loginPage}}
125 - <script> 109 +<script>
126 seajs.use('js/passport/login'); 110 seajs.use('js/passport/login');
127 - </script> 111 +</script>
128 {{/if}} 112 {{/if}}
129 {{!-- 第三方绑定--}} 113 {{!-- 第三方绑定--}}
130 {{#if thirdLogin}} 114 {{#if thirdLogin}}
131 - <script> 115 +<script>
132 seajs.use('js/passport/thirdlogin'); 116 seajs.use('js/passport/thirdlogin');
133 - </script> 117 +</script>
134 {{/if}} 118 {{/if}}
135 -  
136 {{!-- 注册页--}} 119 {{!-- 注册页--}}
137 {{#if registerPage}} 120 {{#if registerPage}}
138 - <script> 121 +<script>
139 seajs.use('js/passport/reg', function (reg) { 122 seajs.use('js/passport/reg', function (reg) {
140 reg.init('reg'); 123 reg.init('reg');
141 }); 124 });
142 - </script> 125 +</script>
143 {{/if}} 126 {{/if}}
144 -  
145 {{!-- 第三方登录完善信息页--}} 127 {{!-- 第三方登录完善信息页--}}
146 {{#if thirdPage}} 128 {{#if thirdPage}}
147 <script> 129 <script>
@@ -150,43 +132,39 @@ @@ -150,43 +132,39 @@
150 }); 132 });
151 </script> 133 </script>
152 {{/if}} 134 {{/if}}
153 -  
154 {{!-- 找回密码--}} 135 {{!-- 找回密码--}}
155 {{#if backPage}} 136 {{#if backPage}}
156 - <script> 137 +<script>
157 seajs.use('js/passport/back'); 138 seajs.use('js/passport/back');
158 - </script> 139 +</script>
159 {{/if}} 140 {{/if}}
160 -  
161 {{!-- 重置密码--}} 141 {{!-- 重置密码--}}
162 {{#if resetPage}} 142 {{#if resetPage}}
163 - <script> 143 +<script>
164 seajs.use('js/passport/reset'); 144 seajs.use('js/passport/reset');
165 - </script> 145 +</script>
166 {{/if}} 146 {{/if}}
167 -  
168 {{!-- 验证手机 --}} 147 {{!-- 验证手机 --}}
169 {{#if vertificationPage}} 148 {{#if vertificationPage}}
170 - <script> 149 +<script>
171 seajs.use('js/passport/vertification'); 150 seajs.use('js/passport/vertification');
172 - </script> 151 +</script>
173 {{/if}} 152 {{/if}}
174 -  
175 {{!-- 热销排行--}} 153 {{!-- 热销排行--}}
176 {{#if hotrankPage}} 154 {{#if hotrankPage}}
177 - <script> 155 +<script>
178 seajs.use('js/product/hotrank'); 156 seajs.use('js/product/hotrank');
179 - </script> 157 +</script>
180 {{/if}} 158 {{/if}}
181 {{!-- 品牌页 --}} 159 {{!-- 品牌页 --}}
182 {{#if brandsHomePage}} 160 {{#if brandsHomePage}}
183 - <script> 161 +<script>
184 seajs.use('js/brand/index'); 162 seajs.use('js/brand/index');
185 - </script> 163 +</script>
186 {{/if}} 164 {{/if}}
187 {{!-- 订单保存--}} 165 {{!-- 订单保存--}}
188 {{#if orderSavePage}} 166 {{#if orderSavePage}}
189 - <script> 167 +<script>
190 seajs.use('js/order/save'); 168 seajs.use('js/order/save');
191 - </script> 169 +</script>
192 {{/if}} 170 {{/if}}
@@ -8,7 +8,7 @@ var handlebars = require('yoho.handlebars'); @@ -8,7 +8,7 @@ var handlebars = require('yoho.handlebars');
8 var json2 = require('json2'); 8 var json2 = require('json2');
9 var vipInfoCombine = null; //用户信息编译模板 9 var vipInfoCombine = null; //用户信息编译模板
10 var loginInfoCombine = null; //登录信息编译模板 10 var loginInfoCombine = null; //登录信息编译模板
11 -var apiDomain = 'http://test.open.yohobuy.com/'; //获取数据的地址http://api.open.yohobuy.com 11 +var apiDomain = $('#api-domain').val(); //获取数据的地址
12 var cartTpl = ''; //购物车模板 12 var cartTpl = ''; //购物车模板
13 /** 13 /**
14 * 搜寻的时候过滤非法字符(+-/:等非法字符单独出现) 14 * 搜寻的时候过滤非法字符(+-/:等非法字符单独出现)
@@ -65,6 +65,8 @@ var bannerMap = { @@ -65,6 +65,8 @@ var bannerMap = {
65 }; 65 };
66 var cookieMap = {}; 66 var cookieMap = {};
67 67
  68 +$('#api-domain').remove(); //删除信息表单
  69 +
68 function getSource(column, postition, event) { 70 function getSource(column, postition, event) {
69 try { 71 try {
70 dataLayer.push({ 72 dataLayer.push({
@@ -120,7 +120,7 @@ @@ -120,7 +120,7 @@
120 } 120 }
121 .tpl-brands{ 121 .tpl-brands{
122 width: 378px; 122 width: 378px;
123 - height: 504px; 123 + height: 512px;
124 li a{ 124 li a{
125 height: 248px; 125 height: 248px;
126 } 126 }
1 <?php 1 <?php
  2 +
2 use Action\WebAction; 3 use Action\WebAction;
3 use Index\HomeModel; 4 use Index\HomeModel;
4 use Configs\WebCacheConfig; 5 use Configs\WebCacheConfig;
@@ -31,8 +32,8 @@ class CommonController extends WebAction @@ -31,8 +32,8 @@ class CommonController extends WebAction
31 $key = WebCacheConfig::KEY_WEB_INDEX_BRANDS_LIST_DATA . '_' . $type; 32 $key = WebCacheConfig::KEY_WEB_INDEX_BRANDS_LIST_DATA . '_' . $type;
32 // array('logoBrand'=>'','moreBrand'=>'') 33 // array('logoBrand'=>'','moreBrand'=>'')
33 $data = Cache::get($key); 34 $data = Cache::get($key);
34 - }  
35 - while (false); 35 +
  36 + } while (false);
36 37
37 $this->echoJson($data); 38 $this->echoJson($data);
38 } 39 }
@@ -49,7 +50,7 @@ class CommonController extends WebAction @@ -49,7 +50,7 @@ class CommonController extends WebAction
49 $result = array(); 50 $result = array();
50 do { 51 do {
51 /* 判断是不是AJAX请求 */ 52 /* 判断是不是AJAX请求 */
52 - if (! $this->isAjax()) { 53 + if (!$this->isAjax()) {
53 break; 54 break;
54 } 55 }
55 $channels = array( 56 $channels = array(
@@ -61,7 +62,7 @@ class CommonController extends WebAction @@ -61,7 +62,7 @@ class CommonController extends WebAction
61 $channel = $this->post('type', ''); 62 $channel = $this->post('type', '');
62 $pageIndex = (int) $this->post('pageIndex', 0); 63 $pageIndex = (int) $this->post('pageIndex', 0);
63 $pageCount = (int) $this->post('pageCount', 8); 64 $pageCount = (int) $this->post('pageCount', 8);
64 - if (! in_array($channel, $channels)) { 65 + if (!in_array($channel, $channels)) {
65 break; 66 break;
66 } 67 }
67 68
@@ -98,43 +99,34 @@ class CommonController extends WebAction @@ -98,43 +99,34 @@ class CommonController extends WebAction
98 */ 99 */
99 public function getbannerAction() 100 public function getbannerAction()
100 { 101 {
101 - $url = 'http://service.api.yohobuy.com/operations/api/v4/resource/get?';  
102 - $content_code = $this->get('content_code', '');  
103 - $client_type = $this->get('client_type', 'web'); 102 + $contentCode = $this->get('content_code', '');
104 $callback = $this->get('callback', ''); 103 $callback = $this->get('callback', '');
105 $width = $this->get('width', ''); 104 $width = $this->get('width', '');
106 $height = $this->get('height', ''); 105 $height = $this->get('height', '');
107 - $params = array(  
108 - 'content_code' => $content_code,  
109 - 'client_type' => $client_type  
110 - );  
111 - $data = IndexData::getResourceData($content_code);//Yohobuy::get($url.http_build_query($params));  
112 - if(empty($data['data']))  
113 - { 106 +
  107 + $data = IndexData::getResourceData($contentCode);
  108 + if (empty($data['data'])) {
114 return $this->helpJsonCallbackResult($callback, 200, '没有数据', ''); 109 return $this->helpJsonCallbackResult($callback, 200, '没有数据', '');
115 - }  
116 - else  
117 - { 110 + } else {
118 $banner = ''; 111 $banner = '';
119 - if(isset($data['data'][0]['data']))  
120 - {  
121 - if($data['data'][0]['template_name'] == 'single_image') { 112 + if (isset($data['data'][0]['data'])) {
  113 + if ($data['data'][0]['template_name'] == 'single_image') {
122 $banner = current($data['data'][0]['data']); 114 $banner = current($data['data'][0]['data']);
123 - } else if($data['data'][0]['template_name'] == 'single_name_image') { 115 + } else if ($data['data'][0]['template_name'] == 'single_name_image') {
124 $banner = $data['data'][0]['data']; 116 $banner = $data['data'][0]['data'];
125 } 117 }
126 - if(!empty($banner)) {  
127 - if(empty($width) || empty($height) ) {  
128 - $width = 2600;//通栏广告 118 + if (!empty($banner)) {
  119 + if (empty($width) || empty($height)) {
  120 + $width = 2600; //通栏广告
129 $height = 60; 121 $height = 60;
130 } 122 }
131 - $banner['src'] = Images::getImageUrl($banner['src'], $width, $height ,2); 123 + $banner['src'] = Images::getImageUrl($banner['src'], $width, $height, 2);
132 //str_replace('?imageView/{mode}/w/{width}/h/{height}', '', $banner['src']); 124 //str_replace('?imageView/{mode}/w/{width}/h/{height}', '', $banner['src']);
133 } 125 }
134 } 126 }
135 - }  
136 return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $banner); 127 return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $banner);
137 } 128 }
  129 + }
138 130
139 /** 131 /**
140 * 获取邮件订阅 132 * 获取邮件订阅
@@ -148,7 +140,7 @@ class CommonController extends WebAction @@ -148,7 +140,7 @@ class CommonController extends WebAction
148 $uid = intval($this->get('uid', '0')); 140 $uid = intval($this->get('uid', '0'));
149 $data = array(); 141 $data = array();
150 //验证邮件 142 //验证邮件
151 - if(Helpers::verifyEmail($email)) { 143 + if (Helpers::verifyEmail($email)) {
152 $data = IndexData::emailSubscriber($email, $uid); 144 $data = IndexData::emailSubscriber($email, $uid);
153 return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $data['data']); 145 return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $data['data']);
154 } else { 146 } else {
@@ -168,7 +160,7 @@ class CommonController extends WebAction @@ -168,7 +160,7 @@ class CommonController extends WebAction
168 $question_id = intval($this->get('question_id', 0)); 160 $question_id = intval($this->get('question_id', 0));
169 $answer = trim($this->get('answer')); 161 $answer = trim($this->get('answer'));
170 $solution = intval($this->get('solution', 0)); 162 $solution = intval($this->get('solution', 0));
171 - if(!empty($feedback_id) || !empty($question_id) || !empty($answer) || !empty($solution)) { 163 + if (!empty($feedback_id) || !empty($question_id) || !empty($answer) || !empty($solution)) {
172 $data = IndexData::suggestFeedback($feedback_id, $question_id, $answer, $solution); 164 $data = IndexData::suggestFeedback($feedback_id, $question_id, $answer, $solution);
173 return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $data['data']); 165 return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $data['data']);
174 } else { 166 } else {
@@ -179,7 +171,6 @@ class CommonController extends WebAction @@ -179,7 +171,6 @@ class CommonController extends WebAction
179 /* 171 /*
180 * 简单头部 172 * 简单头部
181 */ 173 */
182 -  
183 public function getSimpleHeaderAction() 174 public function getSimpleHeaderAction()
184 { 175 {
185 $result = array(); 176 $result = array();
@@ -190,12 +181,11 @@ class CommonController extends WebAction @@ -190,12 +181,11 @@ class CommonController extends WebAction
190 } 181 }
191 182
192 //获取用户 183 //获取用户
193 - $uid = $this->getUid(true); 184 + $uid = $this->getUid(false);
194 if (!$uid) { 185 if (!$uid) {
195 $isLogin = false; 186 $isLogin = false;
196 $username = ''; 187 $username = '';
197 - }  
198 - else { 188 + } else {
199 $isLogin = true; 189 $isLogin = true;
200 $username = $this->_uname; 190 $username = $this->_uname;
201 } 191 }
@@ -212,8 +202,7 @@ class CommonController extends WebAction @@ -212,8 +202,7 @@ class CommonController extends WebAction
212 'userCenter' => Helpers::url('/home?t=' . time()), //用户中心链接 202 'userCenter' => Helpers::url('/home?t=' . time()), //用户中心链接
213 'logout' => Helpers::url('/logout.html?t=' . time()), //退出 203 'logout' => Helpers::url('/logout.html?t=' . time()), //退出
214 ); 204 );
215 - }  
216 - else { 205 + } else {
217 $tool+=array( 206 $tool+=array(
218 'login' => Helpers::url('/signin.html'), //登录链接,已登录不传 207 'login' => Helpers::url('/signin.html'), //登录链接,已登录不传
219 'register' => Helpers::url('/reg.html'), //注册链接,已登录不传 208 'register' => Helpers::url('/reg.html'), //注册链接,已登录不传
@@ -233,8 +222,7 @@ class CommonController extends WebAction @@ -233,8 +222,7 @@ class CommonController extends WebAction
233 'code' => 200, 222 'code' => 200,
234 'data' => $simpleHeader 223 'data' => $simpleHeader
235 ); 224 );
236 - }  
237 - while (false); 225 + } while (false);
238 226
239 $this->echoJson($result); 227 $this->echoJson($result);
240 } 228 }
@@ -21,7 +21,7 @@ class NewModel @@ -21,7 +21,7 @@ class NewModel
21 // 组合搜索商品url 21 // 组合搜索商品url
22 $urlList['product'] = SearchData::getProductUrl($searchCondition['condition']); 22 $urlList['product'] = SearchData::getProductUrl($searchCondition['condition']);
23 // 组合搜索分类url 23 // 组合搜索分类url
24 - $urlList['sort'] = SearchData::getClassesUrl($searchCondition['sortCondition']); 24 + $urlList['sort'] = SearchData::getClassesUrl();
25 // 组合搜索最新上架url 25 // 组合搜索最新上架url
26 $urlList['recent'] = SearchData::getRecentShelveUrl($searchCondition['condition']); 26 $urlList['recent'] = SearchData::getRecentShelveUrl($searchCondition['condition']);
27 27