Authored by 郭成尧

'用户中心为你优选'

@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace Home; 3 namespace Home;
4 4
5 use Home\UserModel; 5 use Home\UserModel;
  6 +use LibModels\Web\Home\UserData;
6 use LibModels\Web\Product\BrandData; 7 use LibModels\Web\Product\BrandData;
7 use WebPlugin\Helpers; 8 use WebPlugin\Helpers;
8 use WebPlugin\HelperHome; 9 use WebPlugin\HelperHome;
@@ -75,6 +76,25 @@ class IndexModel @@ -75,6 +76,25 @@ class IndexModel
75 } 76 }
76 77
77 /** 78 /**
  79 + * @param $channel
  80 + * @param $uid
  81 + * @param $udid
  82 + * @param $recPos
  83 + * @param $limit
  84 + * @return array
  85 + */
  86 + public static function preferenceData($channel, $uid, $udid, $recPos, $limit)
  87 + {
  88 + $response = UserData::newPreference($channel, $uid, $udid, $recPos, $limit);
  89 +
  90 + if ($response['code'] === 200) {
  91 + return HelperHome::formatNew($response['data']['product_list']);
  92 + } else {
  93 + return array();
  94 + }
  95 + }
  96 +
  97 + /**
78 * 底部banner 98 * 底部banner
79 * @param string $code 99 * @param string $code
80 * @return mixed 100 * @return mixed
@@ -82,7 +102,7 @@ class IndexModel @@ -82,7 +102,7 @@ class IndexModel
82 public static function getFooterBanner($code = '20110609-152143') 102 public static function getFooterBanner($code = '20110609-152143')
83 { 103 {
84 104
85 - $banner = BrandData::getByNodeContent($code); 105 + $banner = BrandData::getByNodeContent($code);
86 if (isset($banner['code']) && !empty($banner['data'])) { 106 if (isset($banner['code']) && !empty($banner['data'])) {
87 return $banner['data']; 107 return $banner['data'];
88 } 108 }
@@ -34,6 +34,10 @@ class IndexController extends WebAction @@ -34,6 +34,10 @@ class IndexController extends WebAction
34 $leftNav = UserModel::getCenterLeftNav('', $uid); 34 $leftNav = UserModel::getCenterLeftNav('', $uid);
35 $data = IndexModel::homeData(); 35 $data = IndexModel::homeData();
36 $udid = $uid . $this->getUdid(); 36 $udid = $uid . $this->getUdid();
  37 +
  38 + // 为你优选 tar add 160701
  39 + $data['recommend'] = IndexModel::preferenceData($channel, $uid, $udid, '100004', 30);
  40 +
37 //取消订单原因列表 41 //取消订单原因列表
38 $resons = OrderData::closeReasons(); 42 $resons = OrderData::closeReasons();
39 $cancelReason = isset($resons['data']) ? $resons['data'] : ''; 43 $cancelReason = isset($resons['data']) ? $resons['data'] : '';
@@ -57,7 +61,7 @@ class IndexController extends WebAction @@ -57,7 +61,7 @@ class IndexController extends WebAction
57 'newArrival' => $data['new'] 61 'newArrival' => $data['new']
58 ) 62 )
59 ), 63 ),
60 - 'recommend' => $data['new'], //待处理 64 + 'recommend' => $data['recommend'], //待处理
61 'banner' => IndexModel::getFooterBanner(), 65 'banner' => IndexModel::getFooterBanner(),
62 'helpUsUrl' => '' 66 'helpUsUrl' => ''
63 ); 67 );