Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
7 changed files
with
145 additions
and
153 deletions
@@ -2,14 +2,23 @@ | @@ -2,14 +2,23 @@ | ||
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': |
8 | - new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | ||
9 | - j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | ||
10 | - '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | 9 | + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], |
10 | + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | ||
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,145 +3,127 @@ | @@ -3,145 +3,127 @@ | ||
3 | </script> | 3 | </script> |
4 | {{!-- 正常头部 --}} | 4 | {{!-- 正常头部 --}} |
5 | {{#headerdata}} | 5 | {{#headerdata}} |
6 | - <script> | ||
7 | - seajs.use('js/header'); | ||
8 | - </script> | 6 | +<script> |
7 | + seajs.use('js/header'); | ||
8 | +</script> | ||
9 | {{/headerdata}} | 9 | {{/headerdata}} |
10 | {{!-- 简单头部 --}} | 10 | {{!-- 简单头部 --}} |
11 | {{#simpleHeader}} | 11 | {{#simpleHeader}} |
12 | - <script> | ||
13 | - seajs.use('js/simple-header'); | ||
14 | - </script> | 12 | +<script> |
13 | + seajs.use('js/simple-header'); | ||
14 | +</script> | ||
15 | {{/simpleHeader}} | 15 | {{/simpleHeader}} |
16 | {{!-- 首页 --}} | 16 | {{!-- 首页 --}} |
17 | {{#if boysHomePage}} | 17 | {{#if boysHomePage}} |
18 | - <script> | ||
19 | - seajs.use('js/home/home'); | ||
20 | - </script> | 18 | +<script> |
19 | + seajs.use('js/home/home'); | ||
20 | +</script> | ||
21 | {{/if}} | 21 | {{/if}} |
22 | - | ||
23 | {{!-- 搜索 --}} | 22 | {{!-- 搜索 --}} |
24 | {{#if searchListPage}} | 23 | {{#if searchListPage}} |
25 | - <script> | ||
26 | - seajs.use('js/product/brand'); | ||
27 | - seajs.use(['js/product/list', 'js/product/product'], function (list, product) { | ||
28 | - | ||
29 | - product.init(5); | ||
30 | - window.onresize = function () { | ||
31 | - setTimeout(function () { | ||
32 | - product.init(5); | ||
33 | - }, 300); | ||
34 | - }; | ||
35 | - | ||
36 | - }); | ||
37 | - </script> | 24 | +<script> |
25 | + seajs.use('js/product/brand'); | ||
26 | + seajs.use(['js/product/list', 'js/product/product'], function (list, product) { | ||
27 | + product.init(5); | ||
28 | + window.onresize = function () { | ||
29 | + setTimeout(function () { | ||
30 | + product.init(5); | ||
31 | + }, 300); | ||
32 | + }; | ||
33 | + }); | ||
34 | +</script> | ||
38 | {{/if}} | 35 | {{/if}} |
39 | - | ||
40 | {{!-- 列表 --}} | 36 | {{!-- 列表 --}} |
41 | {{#if productListPage}} | 37 | {{#if productListPage}} |
42 | - <script> | ||
43 | - seajs.use(['js/product/list', 'js/product/product'], function (list, product) { | 38 | +<script> |
39 | + seajs.use(['js/product/list', 'js/product/product'], function (list, product) { | ||
44 | 40 | ||
45 | - product.init(4); | ||
46 | - window.onresize = function () { | ||
47 | - setTimeout(function () { | ||
48 | - product.init(4); | ||
49 | - }, 300); | ||
50 | - }; | 41 | + product.init(4); |
42 | + window.onresize = function () { | ||
43 | + setTimeout(function () { | ||
44 | + product.init(4); | ||
45 | + }, 300); | ||
46 | + }; | ||
51 | 47 | ||
52 | - }); | ||
53 | - </script> | 48 | + }); |
49 | +</script> | ||
54 | {{/if}} | 50 | {{/if}} |
55 | - | ||
56 | {{!-- 商品详情页 --}} | 51 | {{!-- 商品详情页 --}} |
57 | {{#if productDetailPage}} | 52 | {{#if productDetailPage}} |
58 | - <script> | ||
59 | - seajs.use('js/product/item'); | ||
60 | - </script> | 53 | +<script> |
54 | + seajs.use('js/product/item'); | ||
55 | +</script> | ||
61 | {{/if}} | 56 | {{/if}} |
62 | - | ||
63 | {{!-- 逛 --}} | 57 | {{!-- 逛 --}} |
64 | {{#if guangIndexPage}} | 58 | {{#if guangIndexPage}} |
65 | - <script> | ||
66 | - seajs.use('js/guang/index'); | ||
67 | - </script> | 59 | +<script> |
60 | + seajs.use('js/guang/index'); | ||
61 | +</script> | ||
68 | {{/if}} | 62 | {{/if}} |
69 | - | ||
70 | {{!-- 逛详情页 --}} | 63 | {{!-- 逛详情页 --}} |
71 | {{#if guangDetailPage}} | 64 | {{#if guangDetailPage}} |
72 | - <script> | ||
73 | - seajs.use('js/guang/detail'); | ||
74 | - </script> | 65 | +<script> |
66 | + seajs.use('js/guang/detail'); | ||
67 | +</script> | ||
75 | {{/if}} | 68 | {{/if}} |
76 | - | ||
77 | {{!-- 逛列表页 --}} | 69 | {{!-- 逛列表页 --}} |
78 | {{#if guangListPage}} | 70 | {{#if guangListPage}} |
79 | - <script> | ||
80 | - seajs.use('js/guang/list'); | ||
81 | - </script> | 71 | +<script> |
72 | + seajs.use('js/guang/list'); | ||
73 | +</script> | ||
82 | {{/if}} | 74 | {{/if}} |
83 | - | ||
84 | {{!-- SALE --}} | 75 | {{!-- SALE --}} |
85 | {{#if saleIndexPage}} | 76 | {{#if saleIndexPage}} |
86 | - <script> | ||
87 | - seajs.use('js/sale/index'); | ||
88 | - </script> | 77 | +<script> |
78 | + seajs.use('js/sale/index'); | ||
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> | ||
126 | - seajs.use('js/passport/login'); | ||
127 | - </script> | 109 | +<script> |
110 | + seajs.use('js/passport/login'); | ||
111 | +</script> | ||
128 | {{/if}} | 112 | {{/if}} |
129 | {{!-- 第三方绑定--}} | 113 | {{!-- 第三方绑定--}} |
130 | {{#if thirdLogin}} | 114 | {{#if thirdLogin}} |
131 | - <script> | ||
132 | - seajs.use('js/passport/thirdlogin'); | ||
133 | - </script> | 115 | +<script> |
116 | + seajs.use('js/passport/thirdlogin'); | ||
117 | +</script> | ||
134 | {{/if}} | 118 | {{/if}} |
135 | - | ||
136 | {{!-- 注册页--}} | 119 | {{!-- 注册页--}} |
137 | {{#if registerPage}} | 120 | {{#if registerPage}} |
138 | - <script> | ||
139 | - seajs.use('js/passport/reg', function (reg) { | ||
140 | - reg.init('reg'); | ||
141 | - }); | ||
142 | - </script> | 121 | +<script> |
122 | + seajs.use('js/passport/reg', function (reg) { | ||
123 | + reg.init('reg'); | ||
124 | + }); | ||
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> | ||
157 | - seajs.use('js/passport/back'); | ||
158 | - </script> | 137 | +<script> |
138 | + seajs.use('js/passport/back'); | ||
139 | +</script> | ||
159 | {{/if}} | 140 | {{/if}} |
160 | - | ||
161 | {{!-- 重置密码--}} | 141 | {{!-- 重置密码--}} |
162 | {{#if resetPage}} | 142 | {{#if resetPage}} |
163 | - <script> | ||
164 | - seajs.use('js/passport/reset'); | ||
165 | - </script> | 143 | +<script> |
144 | + seajs.use('js/passport/reset'); | ||
145 | +</script> | ||
166 | {{/if}} | 146 | {{/if}} |
167 | - | ||
168 | {{!-- 验证手机 --}} | 147 | {{!-- 验证手机 --}} |
169 | {{#if vertificationPage}} | 148 | {{#if vertificationPage}} |
170 | - <script> | ||
171 | - seajs.use('js/passport/vertification'); | ||
172 | - </script> | 149 | +<script> |
150 | + seajs.use('js/passport/vertification'); | ||
151 | +</script> | ||
173 | {{/if}} | 152 | {{/if}} |
174 | - | ||
175 | {{!-- 热销排行--}} | 153 | {{!-- 热销排行--}} |
176 | {{#if hotrankPage}} | 154 | {{#if hotrankPage}} |
177 | - <script> | ||
178 | - seajs.use('js/product/hotrank'); | ||
179 | - </script> | 155 | +<script> |
156 | + seajs.use('js/product/hotrank'); | ||
157 | +</script> | ||
180 | {{/if}} | 158 | {{/if}} |
181 | {{!-- 品牌页 --}} | 159 | {{!-- 品牌页 --}} |
182 | {{#if brandsHomePage}} | 160 | {{#if brandsHomePage}} |
183 | - <script> | ||
184 | - seajs.use('js/brand/index'); | ||
185 | - </script> | 161 | +<script> |
162 | + seajs.use('js/brand/index'); | ||
163 | +</script> | ||
186 | {{/if}} | 164 | {{/if}} |
187 | {{!-- 订单保存--}} | 165 | {{!-- 订单保存--}} |
188 | {{#if orderSavePage}} | 166 | {{#if orderSavePage}} |
189 | - <script> | ||
190 | - seajs.use('js/order/save'); | ||
191 | - </script> | 167 | +<script> |
168 | + seajs.use('js/order/save'); | ||
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({ |
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; |
@@ -16,23 +17,23 @@ class CommonController extends WebAction | @@ -16,23 +17,23 @@ class CommonController extends WebAction | ||
16 | public function getIndexResourceBrandAction() | 17 | public function getIndexResourceBrandAction() |
17 | { | 18 | { |
18 | $data = array(); | 19 | $data = array(); |
19 | - | 20 | + |
20 | do { | 21 | do { |
21 | if (!$this->isAjax()) { | 22 | if (!$this->isAjax()) { |
22 | break; | 23 | break; |
23 | } | 24 | } |
24 | - | 25 | + |
25 | $type = $this->get('type'); | 26 | $type = $this->get('type'); |
26 | if (empty($type)) { | 27 | if (empty($type)) { |
27 | break; | 28 | break; |
28 | } | 29 | } |
29 | - | 30 | + |
30 | // 首页资源品牌,采用内存存储 | 31 | // 首页资源品牌,采用内存存储 |
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 | ||
@@ -69,7 +70,7 @@ class CommonController extends WebAction | @@ -69,7 +70,7 @@ class CommonController extends WebAction | ||
69 | if (empty($data)) { | 70 | if (empty($data)) { |
70 | break; | 71 | break; |
71 | } | 72 | } |
72 | - | 73 | + |
73 | if ($pageIndex < 0) { | 74 | if ($pageIndex < 0) { |
74 | $pageIndex = 0; | 75 | $pageIndex = 0; |
75 | } | 76 | } |
@@ -87,55 +88,46 @@ class CommonController extends WebAction | @@ -87,55 +88,46 @@ class CommonController extends WebAction | ||
87 | $data = array(); | 88 | $data = array(); |
88 | 89 | ||
89 | } while (false); | 90 | } while (false); |
90 | - | 91 | + |
91 | $this->echoJson($result); | 92 | $this->echoJson($result); |
92 | } | 93 | } |
93 | - | ||
94 | - /** | 94 | + |
95 | + /** | ||
95 | * 获取资源位banner | 96 | * 获取资源位banner |
96 | * | 97 | * |
97 | * @return jsonp | 98 | * @return jsonp |
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;//通栏广告 | ||
129 | - $height = 60; | 118 | + if (!empty($banner)) { |
119 | + if (empty($width) || empty($height)) { | ||
120 | + $width = 2600; //通栏广告 | ||
121 | + $height = 60; | ||
130 | } | 122 | } |
131 | - $banner['src'] = Images::getImageUrl($banner['src'], $width, $height ,2); | ||
132 | - //str_replace('?imageView/{mode}/w/{width}/h/{height}', '', $banner['src']); | 123 | + $banner['src'] = Images::getImageUrl($banner['src'], $width, $height, 2); |
124 | + //str_replace('?imageView/{mode}/w/{width}/h/{height}', '', $banner['src']); | ||
133 | } | 125 | } |
134 | } | 126 | } |
127 | + return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $banner); | ||
135 | } | 128 | } |
136 | - return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $banner); | ||
137 | } | 129 | } |
138 | - | 130 | + |
139 | /** | 131 | /** |
140 | * 获取邮件订阅 | 132 | * 获取邮件订阅 |
141 | * | 133 | * |
@@ -148,14 +140,14 @@ class CommonController extends WebAction | @@ -148,14 +140,14 @@ 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 { |
155 | return $this->helpJsonCallbackResult($callback, 403, '订阅失败', ''); | 147 | return $this->helpJsonCallbackResult($callback, 403, '订阅失败', ''); |
156 | } | 148 | } |
157 | } | 149 | } |
158 | - | 150 | + |
159 | /** | 151 | /** |
160 | * 意见反馈 | 152 | * 意见反馈 |
161 | * | 153 | * |
@@ -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,10 +222,9 @@ class CommonController extends WebAction | @@ -233,10 +222,9 @@ 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 | } |
241 | 229 | ||
242 | -} | ||
230 | +} |
-
Please register or login to post a comment