Authored by hf

to control develop env do not use session

... ... @@ -34,6 +34,7 @@ class AbstractAction extends Controller_Abstract
protected $_uid = 0;
protected $_uname = '';
protected $_vip;
protected $_useSession = true;
/**
* 存放模板数据
... ... @@ -53,16 +54,20 @@ class AbstractAction extends Controller_Abstract
switch (APPLICATION_ENV) {
case 'production': // 生产
$this->_view->assign('rlsEnv', true);
$this->_useSession = true;
break;
case 'preview': // 预览
$this->_view->assign('preEnv', true);
$this->_useSession = true;
break;
case 'testing': // 测试
$this->_view->assign('testEnv', true);
$this->_useSession = true;
break;
case 'develop': // 开发
default:
$this->_view->assign('devEnv', true);
$this->_useSession = false;
break;
}
}
... ... @@ -261,8 +266,10 @@ class AbstractAction extends Controller_Abstract
*/
public function setSession($name, $value)
{
if ($this->_useSession) {
Session::start('yohobuy_session', null, 'yohobuy.com')->__set($name, $value);
}
}
/**
* 获取Session
... ... @@ -272,7 +279,11 @@ class AbstractAction extends Controller_Abstract
*/
public function getSession($name)
{
if ($this->_useSession) {
return Session::start('yohobuy_session', null, 'yohobuy.com')->__get($name);
} else {
return '';
}
}
/**
... ... @@ -283,8 +294,10 @@ class AbstractAction extends Controller_Abstract
*/
protected function getUid($useSession = false)
{
// @todo
// $useSession = false;
// 控制是否启用SESSION
if (!$this->_useSession) {
$useSession = false;
}
if (!$this->_uid) {
$cookie = $this->getCookie('_UID');
... ...