Authored by Rock Zhang

将为您优选提出到单独的异步请求

@@ -51,18 +51,35 @@ class HomeController extends AbstractAction @@ -51,18 +51,35 @@ class HomeController extends AbstractAction
51 ); 51 );
52 $uid = $this->getUid(); 52 $uid = $this->getUid();
53 if ($uid) { 53 if ($uid) {
54 - // 优选新品数据  
55 - $channel = Helpers::getChannelByCookie();  
56 - 54 +
57 $data['isLogin'] = true; 55 $data['isLogin'] = true;
58 $data += UserModel::getUserProfileData($uid); 56 $data += UserModel::getUserProfileData($uid);
59 $data += UserModel::getInfoNumData($uid); 57 $data += UserModel::getInfoNumData($uid);
60 - $data['recommendForYou'] = UserModel::getPreferenceData($channel);  
61 } 58 }
62 59
63 $this->_view->display('index', $data); 60 $this->_view->display('index', $data);
64 } 61 }
65 62
  63 + /**
  64 + * 为您优选
  65 + */
  66 + public function preferenceAction()
  67 + {
  68 + $result = array();
  69 +
  70 + if ($this->isAjax()) {
  71 + // 优选新品数据
  72 + $channel = Helpers::getChannelByCookie();
  73 + $result = UserModel::getPreferenceData($channel);
  74 + }
  75 +
  76 + if (empty($result)) {
  77 + echo ' ';
  78 + } else {
  79 + $this->_view->display('recommend-content', $result);
  80 + }
  81 + }
  82 +
66 /** 83 /**
67 * 用户收藏的商品 84 * 用户收藏的商品
68 */ 85 */