to control develop env do not use session
Showing
1 changed file
with
18 additions
and
5 deletions
@@ -34,6 +34,7 @@ class AbstractAction extends Controller_Abstract | @@ -34,6 +34,7 @@ class AbstractAction extends Controller_Abstract | ||
34 | protected $_uid = 0; | 34 | protected $_uid = 0; |
35 | protected $_uname = ''; | 35 | protected $_uname = ''; |
36 | protected $_vip; | 36 | protected $_vip; |
37 | + protected $_useSession = true; | ||
37 | 38 | ||
38 | /** | 39 | /** |
39 | * 存放模板数据 | 40 | * 存放模板数据 |
@@ -53,16 +54,20 @@ class AbstractAction extends Controller_Abstract | @@ -53,16 +54,20 @@ class AbstractAction extends Controller_Abstract | ||
53 | switch (APPLICATION_ENV) { | 54 | switch (APPLICATION_ENV) { |
54 | case 'production': // 生产 | 55 | case 'production': // 生产 |
55 | $this->_view->assign('rlsEnv', true); | 56 | $this->_view->assign('rlsEnv', true); |
57 | + $this->_useSession = true; | ||
56 | break; | 58 | break; |
57 | case 'preview': // 预览 | 59 | case 'preview': // 预览 |
58 | $this->_view->assign('preEnv', true); | 60 | $this->_view->assign('preEnv', true); |
61 | + $this->_useSession = true; | ||
59 | break; | 62 | break; |
60 | case 'testing': // 测试 | 63 | case 'testing': // 测试 |
61 | $this->_view->assign('testEnv', true); | 64 | $this->_view->assign('testEnv', true); |
65 | + $this->_useSession = true; | ||
62 | break; | 66 | break; |
63 | case 'develop': // 开发 | 67 | case 'develop': // 开发 |
64 | default: | 68 | default: |
65 | $this->_view->assign('devEnv', true); | 69 | $this->_view->assign('devEnv', true); |
70 | + $this->_useSession = false; | ||
66 | break; | 71 | break; |
67 | } | 72 | } |
68 | } | 73 | } |
@@ -261,7 +266,9 @@ class AbstractAction extends Controller_Abstract | @@ -261,7 +266,9 @@ class AbstractAction extends Controller_Abstract | ||
261 | */ | 266 | */ |
262 | public function setSession($name, $value) | 267 | public function setSession($name, $value) |
263 | { | 268 | { |
264 | - Session::start('yohobuy_session', null, 'yohobuy.com')->__set($name, $value); | 269 | + if ($this->_useSession) { |
270 | + Session::start('yohobuy_session', null, 'yohobuy.com')->__set($name, $value); | ||
271 | + } | ||
265 | } | 272 | } |
266 | 273 | ||
267 | /** | 274 | /** |
@@ -272,7 +279,11 @@ class AbstractAction extends Controller_Abstract | @@ -272,7 +279,11 @@ class AbstractAction extends Controller_Abstract | ||
272 | */ | 279 | */ |
273 | public function getSession($name) | 280 | public function getSession($name) |
274 | { | 281 | { |
275 | - return Session::start('yohobuy_session', null, 'yohobuy.com')->__get($name); | 282 | + if ($this->_useSession) { |
283 | + return Session::start('yohobuy_session', null, 'yohobuy.com')->__get($name); | ||
284 | + } else { | ||
285 | + return ''; | ||
286 | + } | ||
276 | } | 287 | } |
277 | 288 | ||
278 | /** | 289 | /** |
@@ -283,9 +294,11 @@ class AbstractAction extends Controller_Abstract | @@ -283,9 +294,11 @@ class AbstractAction extends Controller_Abstract | ||
283 | */ | 294 | */ |
284 | protected function getUid($useSession = false) | 295 | protected function getUid($useSession = false) |
285 | { | 296 | { |
286 | - // @todo | ||
287 | - // $useSession = false; | ||
288 | - | 297 | + // 控制是否启用SESSION |
298 | + if (!$this->_useSession) { | ||
299 | + $useSession = false; | ||
300 | + } | ||
301 | + | ||
289 | if (!$this->_uid) { | 302 | if (!$this->_uid) { |
290 | $cookie = $this->getCookie('_UID'); | 303 | $cookie = $this->getCookie('_UID'); |
291 | if (!empty($cookie)) { | 304 | if (!empty($cookie)) { |
-
Please register or login to post a comment