Authored by yangyang

修改品牌控制器结构

... ... @@ -71,7 +71,7 @@ class Bootstrap extends Bootstrap_Abstract
$controller = 'Index';
$action = 'Index';
// 二级域名
if (2 === $level) {
if (3 === $level) {
$url = strtolower($dispatcher->getRequest()->getRequestUri());
if(empty($url) || $url == '/index' || $url == '/') {
$urlAction = '/index';
... ...
... ... @@ -76,8 +76,23 @@ class BrandsModel
);
}
//根据品牌域名处理相关品牌参数
public static function getBrandByDomain($domain, $fields)
{
$brandInfo = BrandData::getBrandLogoByDomain($domain, $fields);
$result = array();
if (!empty($brandInfo['data']) && $brandInfo['code'] == 200) {
$result['brandId'] = isset($brandInfo['data']['id']) ? $brandInfo['data']['id'] : '';
$result['node'] = isset($brandInfo['data']['static_content_code']) ? $brandInfo['data']['static_content_code'] : false;
$result['brandBanner'] = isset($brandInfo['data']['brand_banner']) ? $brandInfo['data']['brand_banner']: '';
$result['brandNameEn'] = isset($brandInfo['data']['brand_name_en']) ? $brandInfo['data']['brand_name_en'] : '';
$result['brandNameCn'] = isset($brandInfo['data']['brand_name_cn']) ? $brandInfo['data']['brand_name_cn'] : '';
$result['brandAbout'] = isset($brandInfo['data']['brand_intro']) ? $brandInfo['data']['brand_intro'] : '';
} else {
return false;
}
return $result;
}
... ...
... ... @@ -2,6 +2,7 @@
use Action\WebAction;
use LibModels\Web\Product\BrandData;
use LibModels\Web\Product\FavoriteData;
use Product\BrandsModel;
use LibModels\Web\Product\HotrankData;
use product\HotrankModel;
... ... @@ -13,29 +14,24 @@ class IndexController extends WebAction
*/
public function brandAction()
{
//品牌域名
//品牌域名,没有获取到品牌域名的跳转首页
$domain = $this->param('named');
if (empty($domain)) {
$this->go(SITE_MAIN);
}
$uid = $this->getUid();
//根据品牌域名获取品牌id(同时判断品牌域名是否有效)
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页
$fields = 'id,brand_name,brand_name_cn,brand_name_en,brand_domain,brand_alif,brand_banner,brand_ico,static_content_code';
$brandInfo = BrandData::getBrandLogoByDomain($domain, $fields);
if (!empty($brandInfo['data']) && $brandInfo['code'] == 200) {
$brandId = $brandInfo['data']['id'];
$node = isset($brandInfo['data']['static_content_code']) ? $brandInfo['data']['static_content_code'] : false;
$brandBanner = $brandInfo['data']['brand_banner'];
$brandNameEn = $brandInfo['data']['brand_name_en'];
$brandNameCn = $brandInfo['data']['brand_name_cn'];
} else {
$result = BrandsModel::getBrandByDomain($domain, $fields);
if (!$result) {
$this->go(SITE_MAIN);
}
//品牌ID参数
//获取uid
$uid = $this->getUid();
//传品牌ID参数
$condition = array();
$condition['brand'] = $brandId;
$condition['brand'] = isset($result['brandId']) ? $result['brandId'] : '';
//品牌系列参数
$folderId = $this->get('folder_id');
... ... @@ -45,15 +41,15 @@ class IndexController extends WebAction
$options = array();
$options['brandName'] = $domain;
$options['uid'] = $uid;
$options['brandId'] = $brandId;
$options['node'] = $node;
$options['brandBanner'] = $brandBanner;
$options['brandNameEn'] = $brandNameEn;
$options['brandNameCn'] = $brandNameCn;
$options['brandId'] = isset($result['brandId']) ? $result['brandId'] : '';
$options['node'] = isset($result['node']) ? $result['node'] : '';
$options['brandBanner'] = isset($result['brandBanner']) ? $result['brandBanner'] : '';
$options['brandNameEn'] = isset($result['brandNameEn']) ? $result['brandNameEn'] : '';
$options['brandNameCn'] = isset($result['brandNameCn']) ? $result['brandNameCn'] : '';
$options['reviewNum'] = 6;
//调用模型获得数据
$data = Product\BrandsModel::getBrandSearchData($condition, $options);
$data = BrandsModel::getBrandSearchData($condition, $options);
$data = array(
//初始化js
... ... @@ -75,29 +71,26 @@ class IndexController extends WebAction
$this->go(SITE_MAIN);
}
$uid = $this->getUid();
//根据品牌域名获取品牌id(同时判断品牌域名是否有效)
$fields = 'id,brand_name,brand_name_cn,brand_banner,brand_ico,brand_intro';
$brandInfo = BrandData::getBrandLogoByDomain($domain, $fields);
if (!empty($brandInfo['data']) && $brandInfo['code'] == 200) {
$brandId = $brandInfo['data']['id'];
$brandBanner = $brandInfo['data']['brand_banner'];
$brandAbout = $brandInfo['data']['brand_intro'];
} else {
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页
$fields = 'id,brand_name,brand_name_cn,brand_banner,brand_ico,brand_intro';
$result = BrandsModel::getBrandByDomain($domain, $fields);
if (!$result) {
$this->go(SITE_MAIN);
}
//品牌ID参数
$condition = array();
$condition['brand'] = $brandId;
$condition['brand'] = isset($result['brandId']) ? $result['brandId'] : '';
//$options参数数组
$options = array();
$options['brandName'] = $domain;
$options['uid'] = $uid;
$options['brandId'] = $brandId;
$options['brandBanner'] = $brandBanner;
$options['brandAbout'] = $brandAbout;
$options['brandId'] = isset($result['brandId']) ? $result['brandId'] : '';
$options['brandBanner'] = isset($result['brandBanner']) ? $result['brandBanner'] : '';
$options['brandAbout'] = isset($result['brandAbout']) ? $result['brandAbout'] : '';
//调用模型获得数据
$data = Product\BrandsModel::getBrandIntro($condition, $options);
... ...