Authored by yangyang

品牌首页收藏品牌修改

... ... @@ -44,4 +44,14 @@ class FavoriteData {
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE, 'delUidProductFav', array($uid, $productSkn));
}
/**
* 根据uid和商品的skn添加或取消收藏品牌
* @param $uid
* @param $productSkn
* @return bool
*/
public static function changeFavoriteBrand($uid, $productSkn)
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE, 'toggleBrandFav', array($uid, $productSkn));
}
}
... ...
... ... @@ -95,7 +95,7 @@ class HelperSearch
$result['leftContent'][]['newSales'] = self::recentShelve($data['recent']['recent']);
}
//品牌banner
$result['brandBanner'] = isset($data['brand']) ? self::getBannerFormat($data['brand'], $options['brandBanner']) : array();
$result['brandBanner'] = isset($data['brand']) && !empty($data['brand']) ? self::getBannerFormat($data['brand'], $options['brandBanner']) : array();
//总记录数
if (isset($data['product']['total'])) {
$result['totalCount'] = $data['product']['total'];
... ...
<?php
use Action\WebAction;
use LibModels\Web\Product\BrandData;
use LibModels\Web\Product\FavoriteData;
use \LibModels\Web\Product\HotrankData;
use product\HotrankModel;
... ... @@ -50,6 +51,7 @@ class IndexController extends WebAction
//调用模型获得数据
$data = Product\BrandsModel::getBrandSearchData($condition, $options);
$data = array(
//初始化js
'searchListPage' => true,
... ... @@ -106,6 +108,22 @@ class IndexController extends WebAction
//渲染模板
$this->_view->display('list',$data);
}
//收藏品牌
public function favoriteBrandAction($uid = '', $brandId = '')
{
if (!$this->isAjax()) {
return;
}
if ($uid && $brandId) {
//调用接口收藏或取消收藏
$result = FavoriteData::changeFavoriteBrand($uid, $brandId);
if (isset($result['code']) && $result['code'] == 200) {
$this ->echoJson($result['message']);
}
}
}
/**
* 热销排行
*/
... ...