Showing
3 changed files
with
29 additions
and
1 deletions
@@ -44,4 +44,14 @@ class FavoriteData { | @@ -44,4 +44,14 @@ class FavoriteData { | ||
44 | return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE, 'delUidProductFav', array($uid, $productSkn)); | 44 | return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE, 'delUidProductFav', array($uid, $productSkn)); |
45 | } | 45 | } |
46 | 46 | ||
47 | + /** | ||
48 | + * 根据uid和商品的skn添加或取消收藏品牌 | ||
49 | + * @param $uid | ||
50 | + * @param $productSkn | ||
51 | + * @return bool | ||
52 | + */ | ||
53 | + public static function changeFavoriteBrand($uid, $productSkn) | ||
54 | + { | ||
55 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE, 'toggleBrandFav', array($uid, $productSkn)); | ||
56 | + } | ||
47 | } | 57 | } |
@@ -95,7 +95,7 @@ class HelperSearch | @@ -95,7 +95,7 @@ class HelperSearch | ||
95 | $result['leftContent'][]['newSales'] = self::recentShelve($data['recent']['recent']); | 95 | $result['leftContent'][]['newSales'] = self::recentShelve($data['recent']['recent']); |
96 | } | 96 | } |
97 | //品牌banner | 97 | //品牌banner |
98 | - $result['brandBanner'] = isset($data['brand']) ? self::getBannerFormat($data['brand'], $options['brandBanner']) : array(); | 98 | + $result['brandBanner'] = isset($data['brand']) && !empty($data['brand']) ? self::getBannerFormat($data['brand'], $options['brandBanner']) : array(); |
99 | //总记录数 | 99 | //总记录数 |
100 | if (isset($data['product']['total'])) { | 100 | if (isset($data['product']['total'])) { |
101 | $result['totalCount'] = $data['product']['total']; | 101 | $result['totalCount'] = $data['product']['total']; |
1 | <?php | 1 | <?php |
2 | use Action\WebAction; | 2 | use Action\WebAction; |
3 | use LibModels\Web\Product\BrandData; | 3 | use LibModels\Web\Product\BrandData; |
4 | +use LibModels\Web\Product\FavoriteData; | ||
4 | 5 | ||
5 | use \LibModels\Web\Product\HotrankData; | 6 | use \LibModels\Web\Product\HotrankData; |
6 | use product\HotrankModel; | 7 | use product\HotrankModel; |
@@ -50,6 +51,7 @@ class IndexController extends WebAction | @@ -50,6 +51,7 @@ class IndexController extends WebAction | ||
50 | 51 | ||
51 | //调用模型获得数据 | 52 | //调用模型获得数据 |
52 | $data = Product\BrandsModel::getBrandSearchData($condition, $options); | 53 | $data = Product\BrandsModel::getBrandSearchData($condition, $options); |
54 | + | ||
53 | $data = array( | 55 | $data = array( |
54 | //初始化js | 56 | //初始化js |
55 | 'searchListPage' => true, | 57 | 'searchListPage' => true, |
@@ -106,6 +108,22 @@ class IndexController extends WebAction | @@ -106,6 +108,22 @@ class IndexController extends WebAction | ||
106 | //渲染模板 | 108 | //渲染模板 |
107 | $this->_view->display('list',$data); | 109 | $this->_view->display('list',$data); |
108 | } | 110 | } |
111 | + | ||
112 | + //收藏品牌 | ||
113 | + public function favoriteBrandAction($uid = '', $brandId = '') | ||
114 | + { | ||
115 | + if (!$this->isAjax()) { | ||
116 | + return; | ||
117 | + } | ||
118 | + if ($uid && $brandId) { | ||
119 | + //调用接口收藏或取消收藏 | ||
120 | + $result = FavoriteData::changeFavoriteBrand($uid, $brandId); | ||
121 | + if (isset($result['code']) && $result['code'] == 200) { | ||
122 | + $this ->echoJson($result['message']); | ||
123 | + } | ||
124 | + } | ||
125 | + } | ||
126 | + | ||
109 | /** | 127 | /** |
110 | * 热销排行 | 128 | * 热销排行 |
111 | */ | 129 | */ |
-
Please register or login to post a comment