|
@@ -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);
|