Authored by 毕凯

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

1 <!-- Google Tag Manager --> 1 <!-- Google Tag Manager -->
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 -  
4 <script> 3 <script>
5 var _hmt = _hmt || []; 4 var _hmt = _hmt || [];
6 (function() { 5 (function() {
@@ -10,7 +9,6 @@ var _hmt = _hmt || []; @@ -10,7 +9,6 @@ var _hmt = _hmt || [];
10 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 9 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); 10 '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
12 })(window,document,'script','dataLayer','GTM-W958MG'); 11 })(window,document,'script','dataLayer','GTM-W958MG');
13 -  
14 (function() { 12 (function() {
15 var hm = document.createElement("script"); 13 var hm = document.createElement("script");
16 hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311"; 14 hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311";
@@ -18,7 +16,6 @@ var _hmt = _hmt || []; @@ -18,7 +16,6 @@ var _hmt = _hmt || [];
18 var s = document.getElementsByTagName("script")[0]; 16 var s = document.getElementsByTagName("script")[0];
19 s.parentNode.insertBefore(hm, s); 17 s.parentNode.insertBefore(hm, s);
20 })(); 18 })();
21 -  
22 (function() { 19 (function() {
23 var hm = document.createElement("script"); 20 var hm = document.createElement("script");
24 hm.src = "//hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841"; 21 hm.src = "//hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
@@ -26,7 +23,6 @@ var _hmt = _hmt || []; @@ -26,7 +23,6 @@ var _hmt = _hmt || [];
26 var s = document.getElementsByTagName("script")[0]; 23 var s = document.getElementsByTagName("script")[0];
27 s.parentNode.insertBefore(hm, s); 24 s.parentNode.insertBefore(hm, s);
28 })(); 25 })();
29 -  
30 (function() { 26 (function() {
31 var hm = document.createElement("script"); 27 var hm = document.createElement("script");
32 hm.src = "http://static.yohobuy.com/js/analytics/analysis.js"; 28 hm.src = "http://static.yohobuy.com/js/analytics/analysis.js";
@@ -38,28 +34,6 @@ var _hmt = _hmt || []; @@ -38,28 +34,6 @@ var _hmt = _hmt || [];
38 window.addEventListener('load', async_load, false); 34 window.addEventListener('load', async_load, false);
39 })(); 35 })();
40 </script> 36 </script>
41 -<<<<<<< HEAD  
42 -<!-- End Google Tag Manager -->  
43 -<script type="text/javascript">  
44 - var _hmt = _hmt || [];  
45 - (function() {  
46 - var hm = document.createElement("script");  
47 - hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311";  
48 - hm.async = 1;  
49 - var s = document.getElementsByTagName("script")[0];  
50 - s.parentNode.insertBefore(hm, s);  
51 - })();  
52 -</script>  
53 -<script>  
54 - var _hmt = _hmt || [];  
55 - (function() {  
56 - var hm = document.createElement("script");  
57 - hm.src = "//hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";  
58 - hm.async = 1;  
59 - var s = document.getElementsByTagName("script")[0];  
60 - s.parentNode.insertBefore(hm, s);  
61 - })();  
62 -</script>  
63 <script> 37 <script>
64 window._py = window._py||[]; 38 window._py = window._py||[];
65 window._py.push(['a', 'MC..o8vMMWxEXDCiqYckD81lUX']); 39 window._py.push(['a', 'MC..o8vMMWxEXDCiqYckD81lUX']);
@@ -73,5 +47,4 @@ var _hmt = _hmt || []; @@ -73,5 +47,4 @@ var _hmt = _hmt || [];
73 var h = d.getElementsByTagName("script")[0];h.parentNode.insertBefore(c, h); 47 var h = d.getElementsByTagName("script")[0];h.parentNode.insertBefore(c, h);
74 }(document); 48 }(document);
75 </script> 49 </script>
76 -<script src="http://static.yohobuy.com/js/analytics/analysis.js" async="async"></script>  
77 <script src="http://static.yohobuy.com/m/v1/js/om_code.js" async="async"></script> 50 <script src="http://static.yohobuy.com/m/v1/js/om_code.js" async="async"></script>
@@ -17,6 +17,9 @@ class LoginController extends AbstractAction @@ -17,6 +17,9 @@ class LoginController extends AbstractAction
17 */ 17 */
18 public function indexAction() 18 public function indexAction()
19 { 19 {
  20 + // 设置登录有效时间30分钟, 防机器刷
  21 + $this->setSession('_LOGIN_EXPIRE', time() + 1800);
  22 +
20 // 清除客户端 23 // 清除客户端
21 $this->setCookie('_UID', ''); 24 $this->setCookie('_UID', '');
22 $this->setCookie('_TOKEN', ''); 25 $this->setCookie('_TOKEN', '');
@@ -44,9 +47,6 @@ class LoginController extends AbstractAction @@ -44,9 +47,6 @@ class LoginController extends AbstractAction
44 47
45 // 渲染模板 48 // 渲染模板
46 $this->_view->display('index', $data); 49 $this->_view->display('index', $data);
47 -  
48 - // 设置登录有效时间30分钟, 防机器刷  
49 - $this->setSession('_LOGIN_EXPIRE', time() + 1800);  
50 } 50 }
51 51
52 /** 52 /**
@@ -54,6 +54,9 @@ class LoginController extends AbstractAction @@ -54,6 +54,9 @@ class LoginController extends AbstractAction
54 */ 54 */
55 public function internationalAction() 55 public function internationalAction()
56 { 56 {
  57 + // 设置登录有效时间30分钟, 防机器刷
  58 + $this->setSession('_LOGIN_EXPIRE', time() + 1800);
  59 +
57 $refer = $this->get('refer'); 60 $refer = $this->get('refer');
58 if (!empty($refer)) { 61 if (!empty($refer)) {
59 $this->setCookie('refer', $refer); 62 $this->setCookie('refer', $refer);
@@ -70,9 +73,6 @@ class LoginController extends AbstractAction @@ -70,9 +73,6 @@ class LoginController extends AbstractAction
70 $data['countrys'] = RegData::getAreasData(); // 地区信息列表 73 $data['countrys'] = RegData::getAreasData(); // 地区信息列表
71 // 渲染模板 74 // 渲染模板
72 $this->_view->display('international', $data); 75 $this->_view->display('international', $data);
73 -  
74 - // 设置登录有效时间30分钟, 防机器刷  
75 - $this->setSession('_LOGIN_EXPIRE', time() + 1800);  
76 } 76 }
77 77
78 /** 78 /**
@@ -129,13 +129,13 @@ class LoginController extends AbstractAction @@ -129,13 +129,13 @@ class LoginController extends AbstractAction
129 if (!$verifyEmail && !$verifyMobile) { 129 if (!$verifyEmail && !$verifyMobile) {
130 break; 130 break;
131 } 131 }
132 - 132 +
133 /* 设置登录有效时间30分钟, 防机器刷 */ 133 /* 设置登录有效时间30分钟, 防机器刷 */
134 $expire = $this->getSession('_LOGIN_EXPIRE'); 134 $expire = $this->getSession('_LOGIN_EXPIRE');
135 if (empty($expire) || $expire < time()) { 135 if (empty($expire) || $expire < time()) {
136 break; 136 break;
137 } 137 }
138 - 138 +
139 /* 调用登录接口进行登录 */ 139 /* 调用登录接口进行登录 */
140 // 获取未登录时的唯一识别码 140 // 获取未登录时的唯一识别码
141 $shoppingKey = Helpers::getShoppingKeyByCookie(); 141 $shoppingKey = Helpers::getShoppingKeyByCookie();
@@ -157,7 +157,6 @@ class LoginController extends AbstractAction @@ -157,7 +157,6 @@ class LoginController extends AbstractAction
157 $this->setCookie('_TOKEN', $token); 157 $this->setCookie('_TOKEN', $token);
158 $this->setSession('_TOKEN', $token); 158 $this->setSession('_TOKEN', $token);
159 $this->setSession('_LOGIN_UID', $data['data']['uid']); 159 $this->setSession('_LOGIN_UID', $data['data']['uid']);
160 -  
161 } while (false); 160 } while (false);
162 161
163 $this->echoJson($data); 162 $this->echoJson($data);
@@ -226,9 +225,9 @@ class LoginController extends AbstractAction @@ -226,9 +225,9 @@ class LoginController extends AbstractAction
226 225
227 if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { 226 if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
228 $token = Helpers::makeToken($result['data']['uid']); 227 $token = Helpers::makeToken($result['data']['uid']);
229 - $this->setCookie('_TOKEN', $token);  
230 $this->setSession('_TOKEN', $token); 228 $this->setSession('_TOKEN', $token);
231 $this->setSession('_LOGIN_UID', $result['data']['uid']); 229 $this->setSession('_LOGIN_UID', $result['data']['uid']);
  230 + $this->setCookie('_TOKEN', $token);
232 $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); 231 $this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
233 } else { 232 } else {
234 $this->go($refer); 233 $this->go($refer);
@@ -264,9 +263,9 @@ class LoginController extends AbstractAction @@ -264,9 +263,9 @@ class LoginController extends AbstractAction
264 263
265 if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { 264 if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
266 $token = Helpers::makeToken($result['data']['uid']); 265 $token = Helpers::makeToken($result['data']['uid']);
267 - $this->setCookie('_TOKEN', $token);  
268 $this->setSession('_TOKEN', $token); 266 $this->setSession('_TOKEN', $token);
269 $this->setSession('_LOGIN_UID', $result['data']['uid']); 267 $this->setSession('_LOGIN_UID', $result['data']['uid']);
  268 + $this->setCookie('_TOKEN', $token);
270 $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); 269 $this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
271 } else { 270 } else {
272 $this->go($refer); 271 $this->go($refer);
@@ -302,9 +301,9 @@ class LoginController extends AbstractAction @@ -302,9 +301,9 @@ class LoginController extends AbstractAction
302 301
303 if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { 302 if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
304 $token = Helpers::makeToken($result['data']['uid']); 303 $token = Helpers::makeToken($result['data']['uid']);
305 - $this->setCookie('_TOKEN', $token);  
306 $this->setSession('_TOKEN', $token); 304 $this->setSession('_TOKEN', $token);
307 $this->setSession('_LOGIN_UID', $result['data']['uid']); 305 $this->setSession('_LOGIN_UID', $result['data']['uid']);
  306 + $this->setCookie('_TOKEN', $token);
308 $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); 307 $this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
309 } else { 308 } else {
310 $this->go($refer); 309 $this->go($refer);