对账系统自动登录

master
liuweiwen 5 years ago
parent 51844a824e
commit a7e9f62367

@ -83,7 +83,6 @@ class PublicController extends \Think\Controller
'mobile_phone' => $mobile, 'mobile_phone' => $mobile,
'level' => 1, 'level' => 1,
])->find(); ])->find();
if ($promote) { if ($promote) {
/* 记录登录SESSION和COOKIES */ /* 记录登录SESSION和COOKIES */
$cp_auth = array( $cp_auth = array(
@ -96,8 +95,12 @@ class PublicController extends \Think\Controller
); );
$session_name = 'cp_user_auth'; $session_name = 'cp_user_auth';
if (I('auto_login')) { if (I('auto_login')) {
session(['name' => $session_name, 'expire' => 60*60*24*30], $cp_auth); $expireTime = 60*60*24*30;//自动登录一个月
session(['name' => $session_name.'_sign', 'expire' => 60*60*24*30], data_auth_sign($cp_auth)); ini_set('session.gc_maxlifetime', $expireTime);
ini_set('session.cookie_lifetime', $expireTime);
session($session_name, $cp_auth);
session($session_name.'_sign', data_auth_sign($cp_auth));
session($session_name.'_expire', time());
} else { } else {
session($session_name, $cp_auth); session($session_name, $cp_auth);
session($session_name.'_sign', data_auth_sign($cp_auth)); session($session_name.'_sign', data_auth_sign($cp_auth));
@ -117,8 +120,12 @@ class PublicController extends \Think\Controller
); );
$session_name = 'cp_user_auth'; $session_name = 'cp_user_auth';
if (I('auto_login')) { if (I('auto_login')) {
session(['name' => $session_name, 'expire' => 60*60*24*30], $cp_auth); $expireTime = 60*60*24*30;//自动登录一个月
session(['name' => $session_name.'_sign', 'expire' => 60*60*24*30], data_auth_sign($cp_auth)); ini_set('session.gc_maxlifetime', $expireTime);
ini_set('session.cookie_lifetime', $expireTime);
session($session_name, $cp_auth);
session($session_name.'_sign', data_auth_sign($cp_auth));
session($session_name.'_expire', time());
} else { } else {
session($session_name, $cp_auth); session($session_name, $cp_auth);
session($session_name.'_sign', data_auth_sign($cp_auth)); session($session_name.'_sign', data_auth_sign($cp_auth));

Loading…
Cancel
Save