|
|
<?php
|
|
|
<?php
|
|
|
|
|
|
use Action\WebAction;
|
|
|
use LibModels\Web\Product\FavoriteData;
|
|
|
use Product\BrandsModel;
|
|
|
|
|
|
use product\HotrankModel;
|
|
|
|
|
|
class IndexController extends WebAction
|
|
|
{
|
|
|
|
|
|
/**
|
|
|
* 品牌首页
|
|
|
*/
|
|
|
* 品牌首页
|
|
|
*/
|
|
|
public function brandAction()
|
|
|
{
|
|
|
//品牌域名,没有获取到品牌域名的跳转首页
|
|
|
$domain = $this->param('named');
|
|
|
if (empty($domain)) {
|
|
|
$this->go(SITE_MAIN);
|
|
|
}
|
|
|
}
|
|
|
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页
|
|
|
$type = 1;
|
|
|
$result = BrandsModel::getBrandByDomain($domain, $type);
|
|
|
if (!$result) {
|
|
|
$this->go(SITE_MAIN);
|
|
|
}
|
|
|
|
|
|
|
|
|
//获取uid
|
|
|
$uid = $this->getUid();
|
|
|
|
|
|
|
|
|
//传品牌ID参数
|
|
|
$condition = array();
|
|
|
$condition['brand'] = isset($result['brandId']) ? $result['brandId'] : '';
|
|
|
|
|
|
|
|
|
//品牌系列参数
|
|
|
$condition['folder_id'] = $this->get('folder_id');
|
|
|
|
|
|
|
|
|
//$options参数数组
|
|
|
$options = array();
|
|
|
$options['brandName'] = $domain;
|
...
|
...
|
@@ -46,10 +47,10 @@ class IndexController extends WebAction |
|
|
$options['reviewNum'] = 6;
|
|
|
$options['controller'] = 'Index';
|
|
|
$options['action'] = 'brand';
|
|
|
|
|
|
|
|
|
//调用模型获得数据
|
|
|
$data = BrandsModel::getBrandSearchData($condition, $options);
|
|
|
|
|
|
|
|
|
$data = array(
|
|
|
//初始化js
|
|
|
'searchListPage' => true,
|
...
|
...
|
@@ -60,9 +61,9 @@ class IndexController extends WebAction |
|
|
$this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
|
|
|
$this->setWebNavHeader();
|
|
|
//渲染模板
|
|
|
$this->_view->display('list',$data);
|
|
|
$this->_view->display('list', $data);
|
|
|
}
|
|
|
|
|
|
|
|
|
//品牌介绍页
|
|
|
public function aboutAction()
|
|
|
{
|
...
|
...
|
@@ -70,21 +71,21 @@ class IndexController extends WebAction |
|
|
$domain = $this->param('named');
|
|
|
if (empty($domain)) {
|
|
|
$this->go(SITE_MAIN);
|
|
|
}
|
|
|
}
|
|
|
$uid = $this->getUid();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页TODO
|
|
|
$type = 2;
|
|
|
$result = BrandsModel::getBrandByDomain($domain, $type);
|
|
|
if (!$result) {
|
|
|
$this->go(SITE_MAIN);
|
|
|
}
|
|
|
|
|
|
|
|
|
//品牌ID参数
|
|
|
$condition = array();
|
|
|
$condition['brand'] = isset($result['brandId']) ? $result['brandId'] : '';
|
|
|
|
|
|
|
|
|
//$options参数数组
|
|
|
$options = array();
|
|
|
$options['brandName'] = $domain;
|
...
|
...
|
@@ -96,18 +97,18 @@ class IndexController extends WebAction |
|
|
$options['action'] = 'brand';
|
|
|
//调用模型获得数据
|
|
|
$data = BrandsModel::getBrandIntro($condition, $options);
|
|
|
|
|
|
|
|
|
$data = array(
|
|
|
//初始化js
|
|
|
'searchListPage' => true,
|
|
|
'list' => $data
|
|
|
);
|
|
|
|
|
|
|
|
|
$this->setWebNavHeader();
|
|
|
//渲染模板
|
|
|
$this->_view->display('list',$data);
|
|
|
$this->_view->display('list', $data);
|
|
|
}
|
|
|
|
|
|
|
|
|
//收藏品牌
|
|
|
public function favoriteBrandAction()
|
|
|
{
|
...
|
...
|
@@ -117,15 +118,15 @@ class IndexController extends WebAction |
|
|
$result = array(
|
|
|
'code' => 400,
|
|
|
'message' => 'operation failed'
|
|
|
);
|
|
|
);
|
|
|
$uid = $this->getUid();
|
|
|
$brandId = $this->post('brandId');
|
|
|
do{
|
|
|
do {
|
|
|
if (!$uid) {
|
|
|
$result = array(
|
|
|
'code' => 403,
|
|
|
'message' => 'uid is null'
|
|
|
);
|
|
|
);
|
|
|
break;
|
|
|
}
|
|
|
if ($uid && $brandId) {
|
...
|
...
|
@@ -133,46 +134,49 @@ class IndexController extends WebAction |
|
|
$result = FavoriteData::changeFavoriteBrand($uid, $brandId);
|
|
|
break;
|
|
|
}
|
|
|
}while(false);
|
|
|
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
/**
|
|
|
* 热销排行
|
|
|
*/
|
|
|
public function hotrankAction()
|
|
|
public function hotrankAction()
|
|
|
{
|
|
|
//获取频道
|
|
|
$channel = HotrankModel::getChannelResource();
|
|
|
$this->setWebNavHeader($channel['channel']);
|
|
|
$page = $this->get('page',1);
|
|
|
$sort = $this->get('sid',1);
|
|
|
$data = array( 'hotrankPage' => true,
|
|
|
'footerTop'=> true,
|
|
|
'hotrank' => HotrankModel::getHotrankResource($channel, $sort, $page)
|
|
|
);
|
|
|
$this->_view->display('hotrank', $data);
|
|
|
$page = $this->get('page', 1);
|
|
|
$sort = $this->get('sid', 1);
|
|
|
$data = array('hotrankPage' => true,
|
|
|
'footerTop' => true,
|
|
|
'hotrank' => HotrankModel::getHotrankResource($channel, $sort, $page)
|
|
|
);
|
|
|
|
|
|
$this->_view->display('hotrank', $data);
|
|
|
}
|
|
|
|
|
|
|
|
|
/*
|
|
|
* 一周热卖加载更多
|
|
|
*/
|
|
|
|
|
|
public function getdataAction()
|
|
|
{
|
|
|
$page = $this->get('page',1);
|
|
|
$page = $this->get('page', 1);
|
|
|
//加载到100个以后停止
|
|
|
if($page > 2)
|
|
|
{
|
|
|
echo json_encode(array('code'=>201,'data'=>''));
|
|
|
if ($page > 2) {
|
|
|
echo json_encode(array('code' => 201, 'data' => ''));
|
|
|
exit;
|
|
|
}
|
|
|
$sid = $this->get('sid',1);
|
|
|
$sid = $this->get('sid', 1);
|
|
|
//获取频道资源
|
|
|
$channel = HotrankModel::getChannelResource();
|
|
|
//获取一周热卖资源
|
|
|
$data = HotrankModel::getListData($channel, $sid, $page);
|
|
|
$data = HotrankModel::getListData($channel, $sid, $page);
|
|
|
echo json_encode($data);
|
|
|
exit;
|
|
|
exit;
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |
|
|
|
|
|
} |
...
|
...
|
|