Authored by hf

compact with the old station url access rule, and configure the sub domain eg gu…

…ang,list,search,brands...
{{>layout/header}}
<div class="guang-detail-page guang-page yoho-page">
{{# guang}}
<div id="wrapper">
<div id="scroller">
{{# author}}
<div class="author" data-id={{id}}>
<a class="clearfix" href={{url}}>
<img class="avatar" src={{avatar}}>
<span class="name">{{name}}</span>
<span class="intro">{{intro}}</span>
</a>
</div>
{{/ author}}
{{# detail}}
<div class="detail">
<div class="post-title">
<p class="title">{{title}}</p>
{{> guang/tvls}}
</div>
<div class="post-content">
{{# content}}
{{#if text}}
<div class="post-block text-block">
{{text}}
</div>
{{/if}}
{{#if bigImage}}
<div class="post-block big-img-block">
<img class="lazy" data-original={{bigImage}}>
</div>
{{/if}}
{{#if smallImage}}
<div class="post-block small-img-block clearfix">
{{# smallImage}}
<img class="lazy" data-original={{src}}>
{{/ smallImage}}
</div>
{{/if}}
{{#if collocation}}
<div class="post-block collocation-block">
<ul class="thumb-container">
{{#each collocation}}
<li class="thumb {{#if @first}}focus{{/if}}">
<img class="thumb-img lazy" data-original={{thumb}}>
<span class="clothe-type {{type}}"></span>
</li>
{{/each}}
</ul>
<div class="good-list clearfix">
{{#each collocation}}
<div class="prod {{#unless @first}}hide{{/unless}}">
{{# goods}}
{{> good}}
{{/ goods}}
</div>
{{/each}}
</div>
</div>
{{/if}}
{{#if relatedReco}}
<div class="post-block related-reco-block clearfix">
<h2>相关推荐</h2>
{{#if relatedReco.id}}
{{#with relatedReco}}
<div class="one-good">
<img class="thumb lazy" data-original={{thumb}}>
<div class="content-container">
<p>
<span class="reco-name">{{name}}</span>
</p>
<p class="price">
<span class="sale-price {{^price}}no-price{{/price}}">¥{{salePrice}}</span>
{{#price}}
<span class="market-price">¥{{.}}</span>
{{/price}}
<a class="check-detail" href={{url}}>
查看详情
</a>
</p>
</div>
</div>
{{/with}}
{{^}}
<div class="good-list clearfix">
{{# relatedReco}}
{{> good}}
{{/ relatedReco}}
</div>
{{/if}}
</div>
{{/if}}
{{/ content}}
</div>
</div>
{{/ detail}}
{{#if relatedBrand}}
<div class="related-brand">
<h2>相关品牌</h2>
<ul class="brand-list clearfix">
{{# relatedBrand}}
<li class="brand">
<a href={{url}}>
<div class="brand-logo">
<img class="lazy" data-original={{thumb}}>
</div>
<p class="brand-name">{{name}}</p>
</a>
</li>
{{/ relatedBrand}}
</ul>
</div>
{{/if}}
{{#if relatedTag}}
<div class="related-tag">
<div class="tag-bg"></div>
<ul class="tag-list clearfix">
{{# relatedTag}}
<li>
<a href={{url}}>{{name}}</a>
</li>
{{/ relatedTag}}
</ul>
</div>
{{/if}}
{{#if relatedInfo}}
<div class="related-info">
<h2>相关文章</h2>
<ul class="info-list">
{{# relatedInfo}}
<li>
<a class="clearfix" href={{url}}>
<img class="lazy {{#if squareThumb}}square{{/if}}" data-original={{thumb}}>
<span class="title">{{title}}</span>
<span class="publish-time">
<i class="iconfont">&#xe603;</i>
{{publishTime}}
</span>
</a>
</li>
{{/ relatedInfo}}
</ul>
</div>
{{/if}}
</div>
</div>
{{/ guang}}
</div>
{{> layout/footer}}
\ No newline at end of file
{{> layout/header}}
<div class="guang-list-page guang-page yoho-page">
{{# guang}}
<div class="swiper-container">
<div class="swiper-wrapper">
{{# swiper}}
<div class="swiper-slide">
<a href="{{url}}">
<img class="swiper-lazy" data-src="{{img}}">
</a>
<div class="swiper-lazy-preloader"></div>
</div>
{{/ swiper}}
</div>
<div class="swiper-pagination"></div>
</div>
{{# author}}
<div id="author-infos" class="editor-header clearfix" data-id={{id}}>
<div class="avatar">
<img src="{{avatar}}">
</div>
<div class="text">
<p class="name">{{name}}</p>
<p class="info">{{info}}</p>
</div>
</div>
{{/ author}}
<ul id="guang-nav" class="guang-nav clearfix">
{{# navs}}
<li class="guang-nav-item {{#focus}}focus{{/focus}}" data-type={{typeId}}>
{{type}}
</li>
{{/ navs}}
</ul>
<div id="info-list" class="info-list-container">
{{# infos}}
<div class="info-list {{^show}}hide{{/show}}">
{{# info}}
{{> guang/info}}
{{/ info}}
</div>
{{/ infos}}
</div>
<div id="load-more-info" class="load-more-info">
<div class="loading status">
正在加载...
</div>
<span class="no-more status hide">没有更多啦</span>
</div>
<input id="gender" type="hidden" value={{gender}}>
{{/ guang}}
</div>
{{> layout/footer}}
\ No newline at end of file
{{> layout/header}}
<div class="guang-list-page guang-page yoho-page">
{{# guang}}
{{# author}}
<div id="author-infos" class="editor-header clearfix" data-id={{id}}>
<div class="avatar">
<img src="{{avatar}}">
</div>
<div class="text">
<p class="name">{{name}}</p>
<p class="info">{{info}}</p>
</div>
</div>
{{/ author}}
<div id="info-list" class="info-list">
{{# infos}}
{{> guang/info}}
{{/ infos}}
</div>
<div id="load-more-info" class="load-more-info">
<div class="loading status">
正在加载...
</div>
<span class="no-more status hide">没有更多啦</span>
</div>
{{#if tag}}
<input id="tag" type="hidden" value={{tag}}>
{{/if}}
{{/ guang}}
</div>
{{> layout/footer}}
\ No newline at end of file
{{# infos}}
{{> guang/info}}
{{/ infos}}
\ No newline at end of file
{{> layout/header}}
<div class="good-list-page yoho-page">
{{# goodList}}
{{# search}}
<div id="search-input" class="search-input">
<form action="/product/list/index" method="get">
<i class="search-icon iconfont">&#xe60f;</i>
<input type="text" value={{default}} name="query">
<i class="clear-input iconfont hide">&#xe61a;</i>
<button id="search" class="search" type="submit">搜索</button>
</form>
</div>
{{/ search}}
{{# brandWay}}
<div class="brand-way">
<a href={{url}}>
<img class="brand-thumb" src={{thumb}}>
<span>{{name}}</span>
<span class="entry">
进入品牌
<i class="iconfont">&#xe614;</i>
</span>
</a>
</div>
{{/ brandWay}}
{{# brandHome}}
<div id="brand-header" class="brand-header" data-id={{id}}>
<img class="lazy" data-original={{banner}}>
<a class="btn-intro" href="javascript:void(0);">
品牌介绍
</a>
<a class="btn-col" href="javascript:void(0);">
<span class="iconfont">&#xe622;</span>
收藏
</a>
</div>
<div id="intro-box" class="brand-intro-box hide">
<div id="brand-intro" class="brand-intro">
<h2>品牌介绍</h2>
<div class="con">
{{{intro}}}
</div>
<p class="fo">
<span></span>
100%品牌授权正品
</p>
<span class="iconfont close-intro">&#xe623;</span>
</div>
</div>
{{/ brandHome}}
<ul id="list-nav" class="list-nav clearfix">
<li class="new active">
<a href="javascript:void(0);">
最新
<span class="iconfont cur">&#xe616;</span>
</a>
</li>
<li class="price">
<a href="javascript:void(0);">
价格
<span class="icon">
<i class="iconfont up">&#xe615;</i>
<i class="iconfont down cur">&#xe616;</i>
</span>
</a>
</li>
<li class="discount">
<a href="javascript:void(0);">
折扣
<span class="icon">
<i class="iconfont up">&#xe615;</i>
<i class="iconfont down cur">&#xe616;</i>
</span>
</a>
</li>
<li class="filter">
<a href="javascript:void(0);">
筛选
<span class="iconfont">&#xe613;</span>
</a>
</li>
</ul>
<div id="goods-container" class="goods-container">
<div class="new-goods container">
{{# new}}
{{> good}}
{{/ new}}
</div>
<div class="price-goods container hide"></div>
<div class="discount-goods container hide"></div>
{{> filter}}
</div>
{{#if brand}}
<input id="brand" type="hidden" value={{brand}}>
{{/if}}
{{#if gender}}
<input id="gender" type="hidden" value={{gender}}>
{{/if}}
{{#if msort}}
<input id="msort" type="hidden" value={{msort}}>
{{/if}}
{{#if color}}
<input id="color" type="hidden" value={{color}}>
{{/if}}
{{#if size}}
<input id="size" type="hidden" value={{size}}>
{{/if}}
{{#if price}}
<input id="price" type="hidden" value={{price}}>
{{/if}}
{{#if discount}}
<input id="discount" type="hidden" value={{discount}}>
{{/if}}
{{/ goodList}}
</div>
{{> layout/footer}}
\ No newline at end of file
{{# new}}
{{> good}}
{{/ new}}
\ No newline at end of file
<?php
use Action\AbstractAction;
use LibModels\Wap\Guang\DetailData;
use LibModels\Wap\Product\ListData;
use Plugin\Helpers;
/**
* 逛详情页
*/
class DetailController extends AbstractAction
{
/**
* 详情页
*
* @param int id 内容ID
*/
public function indexAction()
{
$id = $this->get('id');
// 判断参数是否有效, 无效会跳转到错误页面
if (!is_numeric($id)) {
$this->error();
}
// 获取详情内容信息, 异常则跳到错误页面
$detail = DetailData::package($id);
if (empty($detail['getArticle'])) {
$this->error();
}
$data = array();
$data['guangDetail'] = true; // 模板中使用JS的标识
$data['guang']['id'] = $id;
// 作者信息数据
if (isset($detail['getAuthor']['name'])) {
$data['guang']['author'] = array();
$data['guang']['author']['avatar'] = $detail['getAuthor']['avatar'];
$data['guang']['author']['name'] = $detail['getAuthor']['name'];
$data['guang']['author']['intro'] = $detail['getAuthor']['author_desc'];
$data['guang']['author']['url'] = '/guang/list/editor?id=' . $detail['getArticle']['author_id'];
}
$data['detail'] = array();
$data['detail']['title'] = $detail['getArticle']['article_title'];
$data['detail']['publishTime'] = $detail['getArticle']['publishTime'];
$data['detail']['pageView'] = $detail['getArticle']['pageViews'];
$data['detail']['content'] = array();
if (!empty($detail['getArticleContent'])) {
$build = array();
$good = array();
$skns = array();
$product = array();
foreach ($detail['getArticleContent'] as $value) {
$build = array();
// 文字
if (isset($value['text'])) {
$build['text'] = $value['text']['data']['text'];
$data['detail']['content'][] = $build;
}
// 单张图
elseif (isset($value['singleImage'])) {
$build['bigImage'] = Helpers::getImageUrl($value['singleImage']['data'][0]['src'], 640, 640);
$data['detail']['content'][] = $build;
}
// 相关推荐
elseif (isset($value['goods']['data'])) {
$good = array();
// 遍历取得SKN
$skns = array();
foreach ($value['goods']['data'] as $goods) {
$skns[] = $goods['id'];
}
// 通过SKN获取商品信息
$product = ListData::productInfoBySkns($skns);
if (!empty($product['data']['product_list'])) {
foreach ($product['data']['product_list'] as $i => $goods) {
// 最多显示4个
if ($i > 3) {
break;
}
$good[] = Helpers::formatProduct($goods, false);
}
}
// 没有商品
if (!isset($i)) {
continue;
}
// 单个商品
elseif ($i === 0) {
$build['relatedReco'] = $good[0];
}
// 多个商品
else {
$build['relatedReco'] = $good;
}
}
// 悬停浮动商品
elseif (isset($value['goodsGroup']['data'])) {
foreach ($value['goodsGroup']['data'] as $goods) {
$good = array();
$good['thumb'] = Helpers::getImageUrl($goods['cover']['cover'], 235, 314);
$good['type'] = Helpers::getProductIcon($goods['cover']['maxSortId']);
$good['goods'] = array();
$skns = array();
foreach ($goods['list'] as $mini) {
$skns[] = $mini['id'];
}
// 通过SKN获取商品信息
$product = ListData::productInfoBySkns($skns);
if (!empty($product['data']['product_list'])) {
foreach ($product['data']['product_list'] as $i => $goods) {
$good['goods'][] = Helpers::formatProduct($goods, false);
}
$build['collocation'][] = $good;
}
}
}
$data['detail']['content'][] = $build;
}
}
// 相关品牌
if (!empty($detail['getBrand'])) {
$data['relatedBrand'] = $detail['getBrand'];
}
// 相关标签
if (!empty($detail['getArticle']['tags'])) {
foreach ($detail['getArticle']['tags'] as $value) {
$value['url'] = '/guang/list/tag?query=' . $value['name'];
$data['relatedTag'][] = $value;
}
}
// 相关文章
if (!empty($detail['getOtherArticle'])) {
foreach ($detail['getOtherArticle'] as $value) {
$value['url'] = '/guang/detail/index?id=' . $value['id'];
$data['relatedInfo'][] = $value;
}
}
$this->_view->display('index', $data);
$detail = array();
$data = array();
}
}
\ No newline at end of file
<?php
use Action\AbstractAction;
use LibModels\Wap\Guang\ListData;
use Plugin\Helpers;
/**
* 逛首页、列表页、编辑页
*/
class ListController extends AbstractAction
{
/**
* 首页
*
* @param int type 分类ID 0:最新,1:话题,2:搭配,3:潮人,4:潮品,5:小贴士
* @param string gender '1,3'表示男,'2,3'表示女
*/
public function indexAction()
{
$this->setTitle('逛');
$this->setNavHeader('逛', true, SITE_MAIN);
$category = ListData::category();
$articleGroup = array();
$uid = $this->getUid();
$udid = $this->getUdid();
$type = $this->get('type', 0);
$gender = $this->get('gender');
// 男
if ($gender === '1,3') {
$articleGroup = ListData::articleGroup($category['data'], '1,3', $uid, $udid);
}
// 女
elseif ($gender === '2,3') {
$articleGroup = ListData::articleGroup($category['data'], '2,3', $uid, $udid);
}
// 所有
else {
$articleGroup = ListData::articleGroup($category['data'], '1,2,3', $uid, $udid);
}
$data = array();
$build = array();
// 模板中使用JS的标识
$data['guangHome'] = true;
// 顶部的分类列表
foreach ($category['data'] as $value) {
$build = array();
$build['typeId'] = $value['id'];
$build['type'] = $value['name'];
$build['focus'] = ($value['id'] == $type);
$data['navs'][] = $build;
}
$data['guang']['swiper'] = array();
$data['guang']['infos'] = array();
foreach ($articleGroup as $id => $value) {
// 判断是否有内容
if (empty($value['list'])) {
continue;
}
// 轮番广告
if ($id == 0) {
$build = array();
foreach ($value['list']['adlist'] as $banner) {
$build['url'] = $banner['url'];
$build['img'] = Helpers::getImageUrl($banner['src'], 830, 327);
$data['guang']['swiper'][] = $build;
}
}
// 内容列表
$build = array();
$build['show'] = ($id == $type);
foreach ($value['list']['artList'] as $article) {
$build['info'][] = Helpers::formatArticle($article, true, false);
}
$data['guang']['infos'][] = $build;
}
// 分页需要参数
$data['guang']['gender'] = $gender;
$this->_view->display('index', $data);
}
/**
* 列表页
*
* @param string tag 标签名称
*/
public function tagAction()
{
$tag = $this->get('query');
$uid = $this->getUid();
$udid = $this->getUdid();
// 标签聚合内容列表
$article = ListData::article('', 0, $uid, $udid, 1, $tag);
// 标签聚合内容不存在, 跳到错误页面
if (empty($article['data']['list']['artList'])) {
$this->error();
}
$this->setTitle($tag);
$this->setNavHeader($tag, true, SITE_MAIN);
$data = array();
// 模板中使用JS的标识
$data['guangList'] = true;
// 构建资讯文章内容
$build = array();
foreach ($article['data']['list']['artList'] as $article) {
$build[] = Helpers::formatArticle($article, true, false);
}
$data['guang']['infos'] = $build;
// 分页需要的参数
$data['guang']['tag'] = $tag;
$this->_view->display('list', $data);
}
/**
* 编辑页
*/
public function editorAction()
{
$id = $this->get('id');
// 获取作者信息
$author = ListData::author($id);
// 作者信息不存在,则跳到错误页面
if (!isset($author['name'])) {
$this->error();
}
$this->setTitle('编辑简介');
$this->setNavHeader('编辑简介', true, SITE_MAIN);
$uid = $this->getUid();
$udid = $this->getUdid();
$data = array();
// 模板中使用JS的标识
$data['guangList'] = true;
// 作者信息
$data['author'] = array();
$data['author']['avatar'] = Helpers::getImageUrl($author['avatar'], 100, 100);
$data['author']['name'] = $author['name'];
$data['author']['info'] = $author['author_desc'];
$data['author']['id'] = $id;
// 标签聚合内容列表
$article = ListData::article('', 0, $uid, $udid, 1, null, $id);
// 构建资讯文章内容
if (!empty($article['data']['list']['artList'])) {
$build = array();
foreach ($article['data']['list']['artList'] as $article) {
$build[] = Helpers::formatArticle($article, true, false, false);
}
$data['guang']['infos'] = $build;
}
$this->_view->display('list', $data);
}
/**
* 逛列表页面的资讯分页
*
* 逛首页、标签页、编辑页资讯列表
*
* @param string tag 标签名称, 没有传空或不传
* @param int type 逛首页的分类ID
* @param int page 分页的页码
* @param string gender "1,2,3"表示所有, "1,3"表示男, "2,3"表示女
* @param int authorId 作者ID
* @return html
*/
public function pageAction()
{
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
/* 判断参数是否有效 */
$tag = $this->get('tag');
$sortId = $this->get('type', 0);
$page = $this->get('page');
$gender = $this->get('gender');
$authorId = $this->get('authorId');
$showAuthor = true;
if (!empty($sortId) && !is_numeric($sortId)) {
break;
}
if (!empty($page) && !is_numeric($page)) {
break;
}
if (!empty($authorId) && is_numeric($authorId)) {
$showAuthor = false;
}
/* 获取资讯文章列表 */
$uid = $this->getUid();
$udid = $this->getUdid();
$page = intval($page) + 1;
$article = ListData::article($gender, $sortId, $uid, $udid, $page, $tag, $authorId);
if (empty($article['data']['list']['artList'])) {
break;
}
/* 构建资讯文章内容 */
$data = array();
$build = array();
foreach ($article['data']['list']['artList'] as $article) {
$build[] = Helpers::formatArticle($article, true, false, $showAuthor);
}
$data['infos'] = $build;
$this->_view->display('page', $data);
exit();
}
while (false);
echo ' ';
}
}
\ No newline at end of file
<?php
use Action\AbstractAction;
use LibModels\Wap\Product\SearchData;
use LibModels\Wap\Category\BrandData;
use LibModels\Wap\Category\ClassData;
use Category\ClassModel;
use Plugin\DataProcess\ListProcess;
use Plugin\Helpers;
/**
* 商品列表页
*/
class ListController extends AbstractAction
{
/**
* 搜索列表页
*/
public function indexAction()
{
$query = $this->get('query', null);
$brand = $this->get('brand', null);
$gender = $this->getCookie('_Channel', 'boys');
$p_d = $this->get('p_d', null);
$misort = $this->get('misort', null);
$msort = $this->get('msort', null);
$data = array(
'pageHeader' => array(
'navBack' => true,
'navTitle' => '搜索',
'navHome' => '/'
),
'goodListPage' => true,
'goodList' => array(
'brand' => 0,
'msort' => 0,
'gender' => $gender,
'price' => 0,
'size' => 0,
'discount' => ''
)
);
// 首先查询是否属于内置品类
$classes = ClassModel::getClassesArr();
$classFlag = array_search($query, $classes);
if($classFlag !== false)// 属于内部品类
{
$data['pageHeader']['navTitle'] = '所有'.$query;
}
// 如果存在搜索字符串就显示搜索栏
if(!is_null($query) && $classFlag === false)
{
$data['search'] = array(
'default' => $query
);
}
// 转换性别
$this->genderTrans($gender);
// 查询数据
$listData = SearchData::searchLiDatas($query, $brand, $gender, $p_d, $misort, $msort);
// 处理返回的数据
if (isset($listData['code']) && $listData['code'] === 200) {
$tmpData = $listData['data'];
// 如果存在品牌信息就显示品牌字段
if(isset($tmpData['brand']) && !empty($tmpData['brand']))
{
$brandData = $tmpData['brand'];
$data['brandWay'] = array(
'url' => '/product/list/brand?brand='.$brandData['id'],
'thumb' => Helpers::getImageUrl($brandData['brand_ico'], 75, 40),
'name' => $brandData['brand_name']
);
// 设置品牌默认值
$data['goodList']['brand'] = $brandData['id'];
}
$data['goodList'] += ListProcess::getListData($tmpData);
}
$this->_view->display('index', $data);
}
/**
* Ajax异步筛选请求
*/
public function searchAction()
{
if($this->isAjax())
{
$query = $this->get('query', null);
$brand = $this->get('brand', null);
$gender = $this->get('gender', null);
$color = $this->get('color', null);
$size = $this->get('size', null);
$price = $this->get('price', null);
$p_d = $this->get('discount', null);
$sort = $this->get('msort', null);
// 转换性别
$this->genderTrans($gender);
// 转换排序方式
$order = $this->get('order', null);
$type = $this->get('type', '');
switch ($type) {
case 'price':
$order = ($order == 0) ? 's_p_desc' : 's_p_asc';
break;
case 'discount':
$order = ($order == 0) ? 'p_d_desc' : 'p_d_asc';
break;
case 'newest':
default:
$order = ($order == 0) ? 's_t_desc' : 's_t_asc';
break;
}
$data = array();
// 查询数据
$listData = SearchData::searchLiDatas($query, $brand, $gender, $color, $size, $price, $p_d, $sort, $order);
// 处理返回的数据
if (isset($listData['code']) && $listData['code'] === 200) {
$tmpData = $listData['data'];
unset($tmpData['filter']);// 不要筛选条件的数据
$data = ListProcess::getListData($tmpData);
}
if(empty($data))
{
echo ' ';
}
else
{
$this->_view->display('list', $data);
}
}
}
/**
* 品牌商品列表页
*/
public function brandAction()
{
$brand = $this->get('brand', null);
$gender = $this->getCookie('_Channel', 'boys');
$sort = $this->get('sort', null);
$color = $this->get('color', null);
$size = $this->get('size', null);
$price = $this->get('price', null);
$p_d = $this->get('discount', null);
$data = array(
'pageHeader' => array(
'navBack' => true,
'navHome' => '/'
),
'goodListPage' => true,
'goodList' => array(
'brandHome' => array(
'id' => $brand
),
'brand' => $brand,
'msort' => 0,
'gender' => $gender,
'sort' => 0,
'price' => 0,
'size' => 0,
'discount' => '',
'p_d' => ''
)
);
// 获取品牌介绍信息
$introData = BrandData::getBrandIntro($brand);
if(isset($introData['code']) && $introData['code'] === 200)
{
$data['goodList']['brandHome']['intro'] = isset($introData['data']['brand_intro']) ? $introData['data']['brand_intro'] : '';
}
// 获取品牌banner的数据
$uid = $this->getUid();
$bannerData = BrandData::getBrandBanner($brand, $uid);
if(isset($bannerData['code']) && $bannerData['code'] === 200)
{
$data['goodList']['brandHome']['banner'] = isset($bannerData['data']['banner']) ? Helpers::getImageUrl($bannerData['data']['banner'], 640, 75) : '';
}
// 查询数据
// 转换性别
$this->genderTrans($gender);
$listData = BrandData::selectBrandDetail($gender, $brand, $sort, $color, $size, $price, $p_d);
// 处理返回的数据
if (isset($listData['code']) && $listData['code'] === 200) {
$tmpData = $listData['data'];
// 设置品牌名称
$data['pageHeader']['navTitle'] = isset($tmpData['brand_name']) ? $tmpData['brand_name'] : '';
$data['goodList'] += ListProcess::getListData($tmpData);
}
$this->_view->display('index', $data);
}
/**
* 品类商品列表页
*/
public function classAction()
{
$brand = $this->get('brand', null);
$gender = $this->getCookie('_Channel', 'boys');
$sort = $this->get('sort', null);
$color = $this->get('color', null);
$size = $this->get('size', null);
$price = $this->get('price', null);
$p_d = $this->get('discount', null);
$data = array(
'pageHeader' => array(
'navBack' => true,
'navHome' => '/'
),
'goodListPage' => true,
'goodList' => array(
'brand' => 0,
'msort' => 0,
'gender' => $gender,
'sort' => $sort,
'price' => 0,
'size' => 0,
'discount' => ''
)
);
// 根据id查询类的名称
$classes = ClassModel::getClassesArr();
$data['pageHeader']['navTitle'] = isset($classes[$sort]) ? $classes[$sort] : '';
// 查询数据
// 转换性别
$this->genderTrans($gender);
$listData = ClassData::selectClassDetail($gender, $brand, $sort, $color, $size, $price, $p_d);
// 处理返回的数据
if (isset($listData['code']) && $listData['code'] === 200) {
$tmpData = $listData['data'];
$data['goodList'] += ListProcess::getListData($tmpData);
}
$this->_view->display('index', $data);
}
/**
* 性别数据转换
*
* @param string &$gender 从cookie中获取的gender值,最后得到转换之后接口调用的值
*/
private function genderTrans(&$gender)
{
if($gender === 'boys')
{
$gender = '1,3';
}
elseif($gender === 'girls')
{
$gender = '2,3';
}
else
{
$gender = '1,2,3';
}
}
}
; 默认页
routes.index.type = "rewrite"
routes.index.match = "/index.html$"
routes.index.route.module = Index
routes.index.route.controller = Index
routes.index.route.action = Index
; 错误页
routes.error.type = "rewrite"
routes.error.match = "/error.html$"
routes.error.route.module = Index
routes.error.route.controller = Error
routes.error.route.action = Index
; 注册页
routes.reg.type = "rewrite"
routes.reg.match = "/reg.html$"
routes.reg.route.module = Passport
routes.reg.route.controller = Reg
routes.reg.route.action = Index
; 登录页
routes.login.type = "rewrite"
routes.login.match = "/signin.html$"
routes.login.route.module = Passport
routes.login.route.controller = Login
routes.login.route.action = Index
; 登录页(国际账号)
routes.interational.type = "rewrite"
routes.interational.match = "/login.html$"
routes.interational.route.module = Passport
routes.interational.route.controller = Login
routes.interational.route.action = International
; 找回密码(手机号)
routes.phoneback.type = "rewrite"
routes.phoneback.match = "/phoneback.html$"
routes.phoneback.route.module = Passport
routes.phoneback.route.controller = Back
routes.phoneback.route.action = Mobile
; 找回密码(邮箱)
routes.emailback.type = "rewrite"
routes.emailback.match = "/emailback.html$"
routes.emailback.route.module = Passport
routes.emailback.route.controller = Back
routes.emailback.route.action = Email