Authored by Rock Zhang

添加对个人中心首页是否登陆状态的判定

@@ -27,7 +27,8 @@ class HomeController extends AbstractAction @@ -27,7 +27,8 @@ class HomeController extends AbstractAction
27 // { 27 // {
28 // // 检查用户是否登录, 未登录则跳转到登录页 28 // // 检查用户是否登录, 未登录则跳转到登录页
29 // $uid = $this->getUid(true); 29 // $uid = $this->getUid(true);
30 -// if (!$uid) { 30 +// $action = $this->getRequest()->getActionName();
  31 +// if (!$uid && $action !== 'index') {
31 // $this->go(Helpers::url('/signin.html')); 32 // $this->go(Helpers::url('/signin.html'));
32 // } 33 // }
33 // 34 //
@@ -43,18 +44,22 @@ class HomeController extends AbstractAction @@ -43,18 +44,22 @@ class HomeController extends AbstractAction
43 $this->setTitle('个人中心'); 44 $this->setTitle('个人中心');
44 $this->setNavHeader('个人中心'); 45 $this->setNavHeader('个人中心');
45 46
46 - // $uid = $this->getUid();  
47 - $uid = 8826435;  
48 - $data = \Index\UserModel::getUserProfileData($uid);  
49 - $data += \Index\UserModel::getInfoNumData($uid);  
50 -  
51 - // 优选新品数据  
52 - $channel = Helpers::getChannelByCookie();  
53 - $data['recommendForYou'] = \Index\UserModel::getPreferenceData($channel);  
54 - // print_r($data);  
55 -  
56 - $data['myIndexPage'] = true;  
57 - $data['pageFooter'] = true; 47 + $data = array(
  48 + 'myIndexPage' => true,
  49 + 'pageFooter' => true
  50 + );
  51 + echo $this->getRequest()->getActionName();
  52 + $uid = $this->getUid();
  53 + if ($uid) {
  54 + $data['isLogin'] = true;
  55 + $uid = 8826435;
  56 + $data += \Index\UserModel::getUserProfileData($uid);
  57 + $data += \Index\UserModel::getInfoNumData($uid);
  58 +
  59 + // 优选新品数据
  60 + $channel = Helpers::getChannelByCookie();
  61 + $data['recommendForYou'] = \Index\UserModel::getPreferenceData($channel);
  62 + }
58 63
59 $this->_view->display('index', $data); 64 $this->_view->display('index', $data);
60 } 65 }