Authored by whb

PC同步

@@ -545,9 +545,14 @@ class WebAction extends Controller_Abstract @@ -545,9 +545,14 @@ class WebAction extends Controller_Abstract
545 $uid = $this->getUid(true); 545 $uid = $this->getUid(true);
546 //是否同步了session 546 //是否同步了session
547 $sysUserSession = intval($this->getSession('_SYS_USER_SESSION')); 547 $sysUserSession = intval($this->getSession('_SYS_USER_SESSION'));
  548 + //同步session时间
  549 + $sysUserSessionTime = $this->getSession('_SYS_USER_SESSION_TIME');
548 if(empty($sysUserSession)) { 550 if(empty($sysUserSession)) {
549 $sysUserSession = 1; 551 $sysUserSession = 1;
550 } 552 }
  553 + if(empty($sysUserSessionTime)) {
  554 + $sysUserSessionTime = 0;
  555 + }
551 if (!empty($channel)) {//设置频道 556 if (!empty($channel)) {//设置频道
552 //\Index\HomeModel::setSwitchToCookie($channel); 557 //\Index\HomeModel::setSwitchToCookie($channel);
553 } 558 }
@@ -568,6 +573,10 @@ class WebAction extends Controller_Abstract @@ -568,6 +573,10 @@ class WebAction extends Controller_Abstract
568 $header['sysUserSession'] = Helpers::syncUserSession($uid); 573 $header['sysUserSession'] = Helpers::syncUserSession($uid);
569 $sysUserSession = $sysUserSession + 1; 574 $sysUserSession = $sysUserSession + 1;
570 $this->setSession('_SYS_USER_SESSION', $sysUserSession); 575 $this->setSession('_SYS_USER_SESSION', $sysUserSession);
  576 + $this->setSession('_SYS_USER_SESSION_TIME', time());
  577 + } //一个小时同步一次
  578 + else if(!empty($uid) && (time() - $sysUserSessionTime) >= 3600) {
  579 + $this->setSession('_SYS_USER_SESSION', 0);
571 } 580 }
572 else if(empty($uid) && $sysUserSession >= 20) { 581 else if(empty($uid) && $sysUserSession >= 20) {
573 $this->setSession('_SYS_USER_SESSION', 0); 582 $this->setSession('_SYS_USER_SESSION', 0);