compact with the old station url access rule, and configure the sub domain eg gu…
…ang,list,search,brands...
Showing
10 changed files
with
0 additions
and
1108 deletions
1 | -{{>layout/header}} | ||
2 | -<div class="guang-detail-page guang-page yoho-page"> | ||
3 | - {{# guang}} | ||
4 | - <div id="wrapper"> | ||
5 | - <div id="scroller"> | ||
6 | - {{# author}} | ||
7 | - <div class="author" data-id={{id}}> | ||
8 | - <a class="clearfix" href={{url}}> | ||
9 | - <img class="avatar" src={{avatar}}> | ||
10 | - <span class="name">{{name}}</span> | ||
11 | - <span class="intro">{{intro}}</span> | ||
12 | - </a> | ||
13 | - </div> | ||
14 | - {{/ author}} | ||
15 | - | ||
16 | - {{# detail}} | ||
17 | - <div class="detail"> | ||
18 | - <div class="post-title"> | ||
19 | - <p class="title">{{title}}</p> | ||
20 | - {{> guang/tvls}} | ||
21 | - </div> | ||
22 | - <div class="post-content"> | ||
23 | - {{# content}} | ||
24 | - {{#if text}} | ||
25 | - <div class="post-block text-block"> | ||
26 | - {{text}} | ||
27 | - </div> | ||
28 | - {{/if}} | ||
29 | - | ||
30 | - {{#if bigImage}} | ||
31 | - <div class="post-block big-img-block"> | ||
32 | - <img class="lazy" data-original={{bigImage}}> | ||
33 | - </div> | ||
34 | - {{/if}} | ||
35 | - | ||
36 | - {{#if smallImage}} | ||
37 | - <div class="post-block small-img-block clearfix"> | ||
38 | - {{# smallImage}} | ||
39 | - <img class="lazy" data-original={{src}}> | ||
40 | - {{/ smallImage}} | ||
41 | - </div> | ||
42 | - {{/if}} | ||
43 | - | ||
44 | - {{#if collocation}} | ||
45 | - <div class="post-block collocation-block"> | ||
46 | - <ul class="thumb-container"> | ||
47 | - {{#each collocation}} | ||
48 | - <li class="thumb {{#if @first}}focus{{/if}}"> | ||
49 | - <img class="thumb-img lazy" data-original={{thumb}}> | ||
50 | - <span class="clothe-type {{type}}"></span> | ||
51 | - </li> | ||
52 | - {{/each}} | ||
53 | - </ul> | ||
54 | - <div class="good-list clearfix"> | ||
55 | - {{#each collocation}} | ||
56 | - <div class="prod {{#unless @first}}hide{{/unless}}"> | ||
57 | - {{# goods}} | ||
58 | - {{> good}} | ||
59 | - {{/ goods}} | ||
60 | - </div> | ||
61 | - {{/each}} | ||
62 | - </div> | ||
63 | - </div> | ||
64 | - {{/if}} | ||
65 | - | ||
66 | - {{#if relatedReco}} | ||
67 | - <div class="post-block related-reco-block clearfix"> | ||
68 | - <h2>相关推荐</h2> | ||
69 | - {{#if relatedReco.id}} | ||
70 | - {{#with relatedReco}} | ||
71 | - <div class="one-good"> | ||
72 | - <img class="thumb lazy" data-original={{thumb}}> | ||
73 | - <div class="content-container"> | ||
74 | - <p> | ||
75 | - <span class="reco-name">{{name}}</span> | ||
76 | - </p> | ||
77 | - <p class="price"> | ||
78 | - <span class="sale-price {{^price}}no-price{{/price}}">¥{{salePrice}}</span> | ||
79 | - {{#price}} | ||
80 | - <span class="market-price">¥{{.}}</span> | ||
81 | - {{/price}} | ||
82 | - <a class="check-detail" href={{url}}> | ||
83 | - 查看详情 | ||
84 | - </a> | ||
85 | - </p> | ||
86 | - </div> | ||
87 | - </div> | ||
88 | - {{/with}} | ||
89 | - {{^}} | ||
90 | - <div class="good-list clearfix"> | ||
91 | - {{# relatedReco}} | ||
92 | - {{> good}} | ||
93 | - {{/ relatedReco}} | ||
94 | - </div> | ||
95 | - {{/if}} | ||
96 | - </div> | ||
97 | - {{/if}} | ||
98 | - {{/ content}} | ||
99 | - </div> | ||
100 | - </div> | ||
101 | - {{/ detail}} | ||
102 | - | ||
103 | - {{#if relatedBrand}} | ||
104 | - <div class="related-brand"> | ||
105 | - <h2>相关品牌</h2> | ||
106 | - <ul class="brand-list clearfix"> | ||
107 | - {{# relatedBrand}} | ||
108 | - <li class="brand"> | ||
109 | - <a href={{url}}> | ||
110 | - <div class="brand-logo"> | ||
111 | - <img class="lazy" data-original={{thumb}}> | ||
112 | - </div> | ||
113 | - <p class="brand-name">{{name}}</p> | ||
114 | - </a> | ||
115 | - </li> | ||
116 | - {{/ relatedBrand}} | ||
117 | - </ul> | ||
118 | - </div> | ||
119 | - {{/if}} | ||
120 | - | ||
121 | - {{#if relatedTag}} | ||
122 | - <div class="related-tag"> | ||
123 | - <div class="tag-bg"></div> | ||
124 | - <ul class="tag-list clearfix"> | ||
125 | - {{# relatedTag}} | ||
126 | - <li> | ||
127 | - <a href={{url}}>{{name}}</a> | ||
128 | - </li> | ||
129 | - {{/ relatedTag}} | ||
130 | - </ul> | ||
131 | - </div> | ||
132 | - {{/if}} | ||
133 | - | ||
134 | - {{#if relatedInfo}} | ||
135 | - <div class="related-info"> | ||
136 | - <h2>相关文章</h2> | ||
137 | - <ul class="info-list"> | ||
138 | - {{# relatedInfo}} | ||
139 | - <li> | ||
140 | - <a class="clearfix" href={{url}}> | ||
141 | - <img class="lazy {{#if squareThumb}}square{{/if}}" data-original={{thumb}}> | ||
142 | - <span class="title">{{title}}</span> | ||
143 | - <span class="publish-time"> | ||
144 | - <i class="iconfont"></i> | ||
145 | - {{publishTime}} | ||
146 | - </span> | ||
147 | - </a> | ||
148 | - </li> | ||
149 | - {{/ relatedInfo}} | ||
150 | - </ul> | ||
151 | - </div> | ||
152 | - {{/if}} | ||
153 | - </div> | ||
154 | - </div> | ||
155 | - {{/ guang}} | ||
156 | -</div> | ||
157 | -{{> layout/footer}} |
1 | -{{> layout/header}} | ||
2 | -<div class="guang-list-page guang-page yoho-page"> | ||
3 | - {{# guang}} | ||
4 | - <div class="swiper-container"> | ||
5 | - <div class="swiper-wrapper"> | ||
6 | - {{# swiper}} | ||
7 | - <div class="swiper-slide"> | ||
8 | - <a href="{{url}}"> | ||
9 | - <img class="swiper-lazy" data-src="{{img}}"> | ||
10 | - </a> | ||
11 | - <div class="swiper-lazy-preloader"></div> | ||
12 | - </div> | ||
13 | - {{/ swiper}} | ||
14 | - </div> | ||
15 | - <div class="swiper-pagination"></div> | ||
16 | - </div> | ||
17 | - | ||
18 | - {{# author}} | ||
19 | - <div id="author-infos" class="editor-header clearfix" data-id={{id}}> | ||
20 | - <div class="avatar"> | ||
21 | - <img src="{{avatar}}"> | ||
22 | - </div> | ||
23 | - <div class="text"> | ||
24 | - <p class="name">{{name}}</p> | ||
25 | - <p class="info">{{info}}</p> | ||
26 | - </div> | ||
27 | - </div> | ||
28 | - {{/ author}} | ||
29 | - | ||
30 | - <ul id="guang-nav" class="guang-nav clearfix"> | ||
31 | - {{# navs}} | ||
32 | - <li class="guang-nav-item {{#focus}}focus{{/focus}}" data-type={{typeId}}> | ||
33 | - {{type}} | ||
34 | - </li> | ||
35 | - {{/ navs}} | ||
36 | - </ul> | ||
37 | - | ||
38 | - <div id="info-list" class="info-list-container"> | ||
39 | - {{# infos}} | ||
40 | - <div class="info-list {{^show}}hide{{/show}}"> | ||
41 | - {{# info}} | ||
42 | - {{> guang/info}} | ||
43 | - {{/ info}} | ||
44 | - </div> | ||
45 | - {{/ infos}} | ||
46 | - </div> | ||
47 | - | ||
48 | - <div id="load-more-info" class="load-more-info"> | ||
49 | - <div class="loading status"> | ||
50 | - 正在加载... | ||
51 | - </div> | ||
52 | - <span class="no-more status hide">没有更多啦</span> | ||
53 | - </div> | ||
54 | - <input id="gender" type="hidden" value={{gender}}> | ||
55 | - {{/ guang}} | ||
56 | -</div> | ||
57 | -{{> layout/footer}} |
1 | -{{> layout/header}} | ||
2 | -<div class="guang-list-page guang-page yoho-page"> | ||
3 | - {{# guang}} | ||
4 | - {{# author}} | ||
5 | - <div id="author-infos" class="editor-header clearfix" data-id={{id}}> | ||
6 | - <div class="avatar"> | ||
7 | - <img src="{{avatar}}"> | ||
8 | - </div> | ||
9 | - <div class="text"> | ||
10 | - <p class="name">{{name}}</p> | ||
11 | - <p class="info">{{info}}</p> | ||
12 | - </div> | ||
13 | - </div> | ||
14 | - {{/ author}} | ||
15 | - | ||
16 | - <div id="info-list" class="info-list"> | ||
17 | - {{# infos}} | ||
18 | - {{> guang/info}} | ||
19 | - {{/ infos}} | ||
20 | - </div> | ||
21 | - | ||
22 | - <div id="load-more-info" class="load-more-info"> | ||
23 | - <div class="loading status"> | ||
24 | - 正在加载... | ||
25 | - </div> | ||
26 | - <span class="no-more status hide">没有更多啦</span> | ||
27 | - </div> | ||
28 | - {{#if tag}} | ||
29 | - <input id="tag" type="hidden" value={{tag}}> | ||
30 | - {{/if}} | ||
31 | - {{/ guang}} | ||
32 | -</div> | ||
33 | -{{> layout/footer}} |
1 | -{{> layout/header}} | ||
2 | -<div class="good-list-page yoho-page"> | ||
3 | - {{# goodList}} | ||
4 | - {{# search}} | ||
5 | - <div id="search-input" class="search-input"> | ||
6 | - <form action="/product/list/index" method="get"> | ||
7 | - <i class="search-icon iconfont"></i> | ||
8 | - <input type="text" value={{default}} name="query"> | ||
9 | - <i class="clear-input iconfont hide"></i> | ||
10 | - <button id="search" class="search" type="submit">搜索</button> | ||
11 | - </form> | ||
12 | - </div> | ||
13 | - {{/ search}} | ||
14 | - | ||
15 | - {{# brandWay}} | ||
16 | - <div class="brand-way"> | ||
17 | - <a href={{url}}> | ||
18 | - <img class="brand-thumb" src={{thumb}}> | ||
19 | - <span>{{name}}</span> | ||
20 | - <span class="entry"> | ||
21 | - 进入品牌 | ||
22 | - <i class="iconfont"></i> | ||
23 | - </span> | ||
24 | - </a> | ||
25 | - </div> | ||
26 | - {{/ brandWay}} | ||
27 | - | ||
28 | - {{# brandHome}} | ||
29 | - <div id="brand-header" class="brand-header" data-id={{id}}> | ||
30 | - <img class="lazy" data-original={{banner}}> | ||
31 | - <a class="btn-intro" href="javascript:void(0);"> | ||
32 | - 品牌介绍 | ||
33 | - </a> | ||
34 | - <a class="btn-col" href="javascript:void(0);"> | ||
35 | - <span class="iconfont"></span> | ||
36 | - 收藏 | ||
37 | - </a> | ||
38 | - </div> | ||
39 | - <div id="intro-box" class="brand-intro-box hide"> | ||
40 | - <div id="brand-intro" class="brand-intro"> | ||
41 | - <h2>品牌介绍</h2> | ||
42 | - <div class="con"> | ||
43 | - {{{intro}}} | ||
44 | - </div> | ||
45 | - <p class="fo"> | ||
46 | - <span></span> | ||
47 | - 100%品牌授权正品 | ||
48 | - </p> | ||
49 | - <span class="iconfont close-intro"></span> | ||
50 | - </div> | ||
51 | - </div> | ||
52 | - {{/ brandHome}} | ||
53 | - | ||
54 | - <ul id="list-nav" class="list-nav clearfix"> | ||
55 | - <li class="new active"> | ||
56 | - <a href="javascript:void(0);"> | ||
57 | - 最新 | ||
58 | - <span class="iconfont cur"></span> | ||
59 | - </a> | ||
60 | - </li> | ||
61 | - <li class="price"> | ||
62 | - <a href="javascript:void(0);"> | ||
63 | - 价格 | ||
64 | - <span class="icon"> | ||
65 | - <i class="iconfont up"></i> | ||
66 | - <i class="iconfont down cur"></i> | ||
67 | - </span> | ||
68 | - </a> | ||
69 | - </li> | ||
70 | - <li class="discount"> | ||
71 | - <a href="javascript:void(0);"> | ||
72 | - 折扣 | ||
73 | - <span class="icon"> | ||
74 | - <i class="iconfont up"></i> | ||
75 | - <i class="iconfont down cur"></i> | ||
76 | - </span> | ||
77 | - </a> | ||
78 | - </li> | ||
79 | - <li class="filter"> | ||
80 | - <a href="javascript:void(0);"> | ||
81 | - 筛选 | ||
82 | - <span class="iconfont"></span> | ||
83 | - </a> | ||
84 | - </li> | ||
85 | - </ul> | ||
86 | - <div id="goods-container" class="goods-container"> | ||
87 | - <div class="new-goods container"> | ||
88 | - {{# new}} | ||
89 | - {{> good}} | ||
90 | - {{/ new}} | ||
91 | - </div> | ||
92 | - <div class="price-goods container hide"></div> | ||
93 | - <div class="discount-goods container hide"></div> | ||
94 | - | ||
95 | - {{> filter}} | ||
96 | - </div> | ||
97 | - | ||
98 | - {{#if brand}} | ||
99 | - <input id="brand" type="hidden" value={{brand}}> | ||
100 | - {{/if}} | ||
101 | - | ||
102 | - {{#if gender}} | ||
103 | - <input id="gender" type="hidden" value={{gender}}> | ||
104 | - {{/if}} | ||
105 | - | ||
106 | - {{#if msort}} | ||
107 | - <input id="msort" type="hidden" value={{msort}}> | ||
108 | - {{/if}} | ||
109 | - | ||
110 | - {{#if color}} | ||
111 | - <input id="color" type="hidden" value={{color}}> | ||
112 | - {{/if}} | ||
113 | - | ||
114 | - {{#if size}} | ||
115 | - <input id="size" type="hidden" value={{size}}> | ||
116 | - {{/if}} | ||
117 | - | ||
118 | - {{#if price}} | ||
119 | - <input id="price" type="hidden" value={{price}}> | ||
120 | - {{/if}} | ||
121 | - | ||
122 | - {{#if discount}} | ||
123 | - <input id="discount" type="hidden" value={{discount}}> | ||
124 | - {{/if}} | ||
125 | - {{/ goodList}} | ||
126 | -</div> | ||
127 | -{{> layout/footer}} |
1 | -<?php | ||
2 | - | ||
3 | -use Action\AbstractAction; | ||
4 | -use LibModels\Wap\Guang\DetailData; | ||
5 | -use LibModels\Wap\Product\ListData; | ||
6 | -use Plugin\Helpers; | ||
7 | - | ||
8 | -/** | ||
9 | - * 逛详情页 | ||
10 | - */ | ||
11 | -class DetailController extends AbstractAction | ||
12 | -{ | ||
13 | - | ||
14 | - /** | ||
15 | - * 详情页 | ||
16 | - * | ||
17 | - * @param int id 内容ID | ||
18 | - */ | ||
19 | - public function indexAction() | ||
20 | - { | ||
21 | - $id = $this->get('id'); | ||
22 | - | ||
23 | - // 判断参数是否有效, 无效会跳转到错误页面 | ||
24 | - if (!is_numeric($id)) { | ||
25 | - $this->error(); | ||
26 | - } | ||
27 | - | ||
28 | - // 获取详情内容信息, 异常则跳到错误页面 | ||
29 | - $detail = DetailData::package($id); | ||
30 | - if (empty($detail['getArticle'])) { | ||
31 | - $this->error(); | ||
32 | - } | ||
33 | - | ||
34 | - $data = array(); | ||
35 | - $data['guangDetail'] = true; // 模板中使用JS的标识 | ||
36 | - $data['guang']['id'] = $id; | ||
37 | - | ||
38 | - // 作者信息数据 | ||
39 | - if (isset($detail['getAuthor']['name'])) { | ||
40 | - $data['guang']['author'] = array(); | ||
41 | - $data['guang']['author']['avatar'] = $detail['getAuthor']['avatar']; | ||
42 | - $data['guang']['author']['name'] = $detail['getAuthor']['name']; | ||
43 | - $data['guang']['author']['intro'] = $detail['getAuthor']['author_desc']; | ||
44 | - $data['guang']['author']['url'] = '/guang/list/editor?id=' . $detail['getArticle']['author_id']; | ||
45 | - } | ||
46 | - | ||
47 | - $data['detail'] = array(); | ||
48 | - $data['detail']['title'] = $detail['getArticle']['article_title']; | ||
49 | - $data['detail']['publishTime'] = $detail['getArticle']['publishTime']; | ||
50 | - $data['detail']['pageView'] = $detail['getArticle']['pageViews']; | ||
51 | - $data['detail']['content'] = array(); | ||
52 | - | ||
53 | - if (!empty($detail['getArticleContent'])) { | ||
54 | - $build = array(); | ||
55 | - $good = array(); | ||
56 | - $skns = array(); | ||
57 | - $product = array(); | ||
58 | - foreach ($detail['getArticleContent'] as $value) { | ||
59 | - $build = array(); | ||
60 | - // 文字 | ||
61 | - if (isset($value['text'])) { | ||
62 | - $build['text'] = $value['text']['data']['text']; | ||
63 | - $data['detail']['content'][] = $build; | ||
64 | - } | ||
65 | - // 单张图 | ||
66 | - elseif (isset($value['singleImage'])) { | ||
67 | - $build['bigImage'] = Helpers::getImageUrl($value['singleImage']['data'][0]['src'], 640, 640); | ||
68 | - $data['detail']['content'][] = $build; | ||
69 | - } | ||
70 | - // 相关推荐 | ||
71 | - elseif (isset($value['goods']['data'])) { | ||
72 | - $good = array(); | ||
73 | - // 遍历取得SKN | ||
74 | - $skns = array(); | ||
75 | - foreach ($value['goods']['data'] as $goods) { | ||
76 | - $skns[] = $goods['id']; | ||
77 | - } | ||
78 | - // 通过SKN获取商品信息 | ||
79 | - $product = ListData::productInfoBySkns($skns); | ||
80 | - if (!empty($product['data']['product_list'])) { | ||
81 | - foreach ($product['data']['product_list'] as $i => $goods) { | ||
82 | - // 最多显示4个 | ||
83 | - if ($i > 3) { | ||
84 | - break; | ||
85 | - } | ||
86 | - $good[] = Helpers::formatProduct($goods, false); | ||
87 | - } | ||
88 | - } | ||
89 | - // 没有商品 | ||
90 | - if (!isset($i)) { | ||
91 | - continue; | ||
92 | - } | ||
93 | - // 单个商品 | ||
94 | - elseif ($i === 0) { | ||
95 | - $build['relatedReco'] = $good[0]; | ||
96 | - } | ||
97 | - // 多个商品 | ||
98 | - else { | ||
99 | - $build['relatedReco'] = $good; | ||
100 | - } | ||
101 | - } | ||
102 | - // 悬停浮动商品 | ||
103 | - elseif (isset($value['goodsGroup']['data'])) { | ||
104 | - foreach ($value['goodsGroup']['data'] as $goods) { | ||
105 | - $good = array(); | ||
106 | - $good['thumb'] = Helpers::getImageUrl($goods['cover']['cover'], 235, 314); | ||
107 | - $good['type'] = Helpers::getProductIcon($goods['cover']['maxSortId']); | ||
108 | - $good['goods'] = array(); | ||
109 | - $skns = array(); | ||
110 | - foreach ($goods['list'] as $mini) { | ||
111 | - $skns[] = $mini['id']; | ||
112 | - } | ||
113 | - // 通过SKN获取商品信息 | ||
114 | - $product = ListData::productInfoBySkns($skns); | ||
115 | - if (!empty($product['data']['product_list'])) { | ||
116 | - foreach ($product['data']['product_list'] as $i => $goods) { | ||
117 | - $good['goods'][] = Helpers::formatProduct($goods, false); | ||
118 | - } | ||
119 | - $build['collocation'][] = $good; | ||
120 | - } | ||
121 | - } | ||
122 | - } | ||
123 | - | ||
124 | - $data['detail']['content'][] = $build; | ||
125 | - } | ||
126 | - } | ||
127 | - | ||
128 | - // 相关品牌 | ||
129 | - if (!empty($detail['getBrand'])) { | ||
130 | - $data['relatedBrand'] = $detail['getBrand']; | ||
131 | - } | ||
132 | - | ||
133 | - // 相关标签 | ||
134 | - if (!empty($detail['getArticle']['tags'])) { | ||
135 | - foreach ($detail['getArticle']['tags'] as $value) { | ||
136 | - $value['url'] = '/guang/list/tag?query=' . $value['name']; | ||
137 | - $data['relatedTag'][] = $value; | ||
138 | - } | ||
139 | - } | ||
140 | - | ||
141 | - // 相关文章 | ||
142 | - if (!empty($detail['getOtherArticle'])) { | ||
143 | - foreach ($detail['getOtherArticle'] as $value) { | ||
144 | - $value['url'] = '/guang/detail/index?id=' . $value['id']; | ||
145 | - $data['relatedInfo'][] = $value; | ||
146 | - } | ||
147 | - } | ||
148 | - | ||
149 | - $this->_view->display('index', $data); | ||
150 | - | ||
151 | - $detail = array(); | ||
152 | - $data = array(); | ||
153 | - } | ||
154 | -} |
1 | -<?php | ||
2 | - | ||
3 | -use Action\AbstractAction; | ||
4 | -use LibModels\Wap\Guang\ListData; | ||
5 | -use Plugin\Helpers; | ||
6 | - | ||
7 | -/** | ||
8 | - * 逛首页、列表页、编辑页 | ||
9 | - */ | ||
10 | -class ListController extends AbstractAction | ||
11 | -{ | ||
12 | - /** | ||
13 | - * 首页 | ||
14 | - * | ||
15 | - * @param int type 分类ID 0:最新,1:话题,2:搭配,3:潮人,4:潮品,5:小贴士 | ||
16 | - * @param string gender '1,3'表示男,'2,3'表示女 | ||
17 | - */ | ||
18 | - public function indexAction() | ||
19 | - { | ||
20 | - $this->setTitle('逛'); | ||
21 | - $this->setNavHeader('逛', true, SITE_MAIN); | ||
22 | - | ||
23 | - $category = ListData::category(); | ||
24 | - $articleGroup = array(); | ||
25 | - | ||
26 | - $uid = $this->getUid(); | ||
27 | - $udid = $this->getUdid(); | ||
28 | - $type = $this->get('type', 0); | ||
29 | - $gender = $this->get('gender'); | ||
30 | - | ||
31 | - // 男 | ||
32 | - if ($gender === '1,3') { | ||
33 | - $articleGroup = ListData::articleGroup($category['data'], '1,3', $uid, $udid); | ||
34 | - } | ||
35 | - // 女 | ||
36 | - elseif ($gender === '2,3') { | ||
37 | - $articleGroup = ListData::articleGroup($category['data'], '2,3', $uid, $udid); | ||
38 | - } | ||
39 | - // 所有 | ||
40 | - else { | ||
41 | - $articleGroup = ListData::articleGroup($category['data'], '1,2,3', $uid, $udid); | ||
42 | - } | ||
43 | - | ||
44 | - $data = array(); | ||
45 | - $build = array(); | ||
46 | - | ||
47 | - // 模板中使用JS的标识 | ||
48 | - $data['guangHome'] = true; | ||
49 | - | ||
50 | - // 顶部的分类列表 | ||
51 | - foreach ($category['data'] as $value) { | ||
52 | - $build = array(); | ||
53 | - $build['typeId'] = $value['id']; | ||
54 | - $build['type'] = $value['name']; | ||
55 | - $build['focus'] = ($value['id'] == $type); | ||
56 | - $data['navs'][] = $build; | ||
57 | - } | ||
58 | - | ||
59 | - $data['guang']['swiper'] = array(); | ||
60 | - $data['guang']['infos'] = array(); | ||
61 | - foreach ($articleGroup as $id => $value) { | ||
62 | - // 判断是否有内容 | ||
63 | - if (empty($value['list'])) { | ||
64 | - continue; | ||
65 | - } | ||
66 | - | ||
67 | - // 轮番广告 | ||
68 | - if ($id == 0) { | ||
69 | - $build = array(); | ||
70 | - foreach ($value['list']['adlist'] as $banner) { | ||
71 | - $build['url'] = $banner['url']; | ||
72 | - $build['img'] = Helpers::getImageUrl($banner['src'], 830, 327); | ||
73 | - $data['guang']['swiper'][] = $build; | ||
74 | - } | ||
75 | - } | ||
76 | - | ||
77 | - // 内容列表 | ||
78 | - $build = array(); | ||
79 | - $build['show'] = ($id == $type); | ||
80 | - foreach ($value['list']['artList'] as $article) { | ||
81 | - $build['info'][] = Helpers::formatArticle($article, true, false); | ||
82 | - } | ||
83 | - $data['guang']['infos'][] = $build; | ||
84 | - } | ||
85 | - | ||
86 | - // 分页需要参数 | ||
87 | - $data['guang']['gender'] = $gender; | ||
88 | - | ||
89 | - $this->_view->display('index', $data); | ||
90 | - } | ||
91 | - | ||
92 | - /** | ||
93 | - * 列表页 | ||
94 | - * | ||
95 | - * @param string tag 标签名称 | ||
96 | - */ | ||
97 | - public function tagAction() | ||
98 | - { | ||
99 | - $tag = $this->get('query'); | ||
100 | - $uid = $this->getUid(); | ||
101 | - $udid = $this->getUdid(); | ||
102 | - | ||
103 | - // 标签聚合内容列表 | ||
104 | - $article = ListData::article('', 0, $uid, $udid, 1, $tag); | ||
105 | - // 标签聚合内容不存在, 跳到错误页面 | ||
106 | - if (empty($article['data']['list']['artList'])) { | ||
107 | - $this->error(); | ||
108 | - } | ||
109 | - | ||
110 | - $this->setTitle($tag); | ||
111 | - $this->setNavHeader($tag, true, SITE_MAIN); | ||
112 | - | ||
113 | - $data = array(); | ||
114 | - // 模板中使用JS的标识 | ||
115 | - $data['guangList'] = true; | ||
116 | - | ||
117 | - // 构建资讯文章内容 | ||
118 | - $build = array(); | ||
119 | - foreach ($article['data']['list']['artList'] as $article) { | ||
120 | - $build[] = Helpers::formatArticle($article, true, false); | ||
121 | - } | ||
122 | - $data['guang']['infos'] = $build; | ||
123 | - | ||
124 | - // 分页需要的参数 | ||
125 | - $data['guang']['tag'] = $tag; | ||
126 | - | ||
127 | - $this->_view->display('list', $data); | ||
128 | - } | ||
129 | - | ||
130 | - /** | ||
131 | - * 编辑页 | ||
132 | - */ | ||
133 | - public function editorAction() | ||
134 | - { | ||
135 | - $id = $this->get('id'); | ||
136 | - | ||
137 | - // 获取作者信息 | ||
138 | - $author = ListData::author($id); | ||
139 | - // 作者信息不存在,则跳到错误页面 | ||
140 | - if (!isset($author['name'])) { | ||
141 | - $this->error(); | ||
142 | - } | ||
143 | - | ||
144 | - $this->setTitle('编辑简介'); | ||
145 | - $this->setNavHeader('编辑简介', true, SITE_MAIN); | ||
146 | - | ||
147 | - $uid = $this->getUid(); | ||
148 | - $udid = $this->getUdid(); | ||
149 | - | ||
150 | - $data = array(); | ||
151 | - // 模板中使用JS的标识 | ||
152 | - $data['guangList'] = true; | ||
153 | - | ||
154 | - // 作者信息 | ||
155 | - $data['author'] = array(); | ||
156 | - $data['author']['avatar'] = Helpers::getImageUrl($author['avatar'], 100, 100); | ||
157 | - $data['author']['name'] = $author['name']; | ||
158 | - $data['author']['info'] = $author['author_desc']; | ||
159 | - $data['author']['id'] = $id; | ||
160 | - | ||
161 | - // 标签聚合内容列表 | ||
162 | - $article = ListData::article('', 0, $uid, $udid, 1, null, $id); | ||
163 | - // 构建资讯文章内容 | ||
164 | - if (!empty($article['data']['list']['artList'])) { | ||
165 | - $build = array(); | ||
166 | - foreach ($article['data']['list']['artList'] as $article) { | ||
167 | - $build[] = Helpers::formatArticle($article, true, false, false); | ||
168 | - } | ||
169 | - $data['guang']['infos'] = $build; | ||
170 | - } | ||
171 | - | ||
172 | - $this->_view->display('list', $data); | ||
173 | - } | ||
174 | - | ||
175 | - /** | ||
176 | - * 逛列表页面的资讯分页 | ||
177 | - * | ||
178 | - * 逛首页、标签页、编辑页资讯列表 | ||
179 | - * | ||
180 | - * @param string tag 标签名称, 没有传空或不传 | ||
181 | - * @param int type 逛首页的分类ID | ||
182 | - * @param int page 分页的页码 | ||
183 | - * @param string gender "1,2,3"表示所有, "1,3"表示男, "2,3"表示女 | ||
184 | - * @param int authorId 作者ID | ||
185 | - * @return html | ||
186 | - */ | ||
187 | - public function pageAction() | ||
188 | - { | ||
189 | - do { | ||
190 | - /* 判断是不是AJAX请求 */ | ||
191 | - if (!$this->isAjax()) { | ||
192 | - break; | ||
193 | - } | ||
194 | - | ||
195 | - /* 判断参数是否有效 */ | ||
196 | - $tag = $this->get('tag'); | ||
197 | - $sortId = $this->get('type', 0); | ||
198 | - $page = $this->get('page'); | ||
199 | - $gender = $this->get('gender'); | ||
200 | - $authorId = $this->get('authorId'); | ||
201 | - $showAuthor = true; | ||
202 | - if (!empty($sortId) && !is_numeric($sortId)) { | ||
203 | - break; | ||
204 | - } | ||
205 | - if (!empty($page) && !is_numeric($page)) { | ||
206 | - | ||
207 | - break; | ||
208 | - } | ||
209 | - if (!empty($authorId) && is_numeric($authorId)) { | ||
210 | - $showAuthor = false; | ||
211 | - } | ||
212 | - | ||
213 | - /* 获取资讯文章列表 */ | ||
214 | - $uid = $this->getUid(); | ||
215 | - $udid = $this->getUdid(); | ||
216 | - $page = intval($page) + 1; | ||
217 | - $article = ListData::article($gender, $sortId, $uid, $udid, $page, $tag, $authorId); | ||
218 | - if (empty($article['data']['list']['artList'])) { | ||
219 | - break; | ||
220 | - } | ||
221 | - | ||
222 | - /* 构建资讯文章内容 */ | ||
223 | - $data = array(); | ||
224 | - $build = array(); | ||
225 | - foreach ($article['data']['list']['artList'] as $article) { | ||
226 | - $build[] = Helpers::formatArticle($article, true, false, $showAuthor); | ||
227 | - } | ||
228 | - $data['infos'] = $build; | ||
229 | - | ||
230 | - $this->_view->display('page', $data); | ||
231 | - | ||
232 | - exit(); | ||
233 | - } | ||
234 | - while (false); | ||
235 | - | ||
236 | - echo ' '; | ||
237 | - } | ||
238 | - | ||
239 | -} |
1 | -<?php | ||
2 | - | ||
3 | -use Action\AbstractAction; | ||
4 | -use LibModels\Wap\Product\SearchData; | ||
5 | -use LibModels\Wap\Category\BrandData; | ||
6 | -use LibModels\Wap\Category\ClassData; | ||
7 | -use Category\ClassModel; | ||
8 | -use Plugin\DataProcess\ListProcess; | ||
9 | -use Plugin\Helpers; | ||
10 | - | ||
11 | -/** | ||
12 | - * 商品列表页 | ||
13 | - */ | ||
14 | -class ListController extends AbstractAction | ||
15 | -{ | ||
16 | - /** | ||
17 | - * 搜索列表页 | ||
18 | - */ | ||
19 | - public function indexAction() | ||
20 | - { | ||
21 | - $query = $this->get('query', null); | ||
22 | - $brand = $this->get('brand', null); | ||
23 | - $gender = $this->getCookie('_Channel', 'boys'); | ||
24 | - $p_d = $this->get('p_d', null); | ||
25 | - $misort = $this->get('misort', null); | ||
26 | - $msort = $this->get('msort', null); | ||
27 | - | ||
28 | - $data = array( | ||
29 | - 'pageHeader' => array( | ||
30 | - 'navBack' => true, | ||
31 | - 'navTitle' => '搜索', | ||
32 | - 'navHome' => '/' | ||
33 | - ), | ||
34 | - 'goodListPage' => true, | ||
35 | - 'goodList' => array( | ||
36 | - 'brand' => 0, | ||
37 | - 'msort' => 0, | ||
38 | - 'gender' => $gender, | ||
39 | - 'price' => 0, | ||
40 | - 'size' => 0, | ||
41 | - 'discount' => '' | ||
42 | - ) | ||
43 | - ); | ||
44 | - | ||
45 | - // 首先查询是否属于内置品类 | ||
46 | - $classes = ClassModel::getClassesArr(); | ||
47 | - $classFlag = array_search($query, $classes); | ||
48 | - if($classFlag !== false)// 属于内部品类 | ||
49 | - { | ||
50 | - $data['pageHeader']['navTitle'] = '所有'.$query; | ||
51 | - } | ||
52 | - | ||
53 | - // 如果存在搜索字符串就显示搜索栏 | ||
54 | - if(!is_null($query) && $classFlag === false) | ||
55 | - { | ||
56 | - $data['search'] = array( | ||
57 | - 'default' => $query | ||
58 | - ); | ||
59 | - } | ||
60 | - | ||
61 | - // 转换性别 | ||
62 | - $this->genderTrans($gender); | ||
63 | - | ||
64 | - // 查询数据 | ||
65 | - $listData = SearchData::searchLiDatas($query, $brand, $gender, $p_d, $misort, $msort); | ||
66 | - // 处理返回的数据 | ||
67 | - if (isset($listData['code']) && $listData['code'] === 200) { | ||
68 | - $tmpData = $listData['data']; | ||
69 | - | ||
70 | - // 如果存在品牌信息就显示品牌字段 | ||
71 | - if(isset($tmpData['brand']) && !empty($tmpData['brand'])) | ||
72 | - { | ||
73 | - $brandData = $tmpData['brand']; | ||
74 | - $data['brandWay'] = array( | ||
75 | - 'url' => '/product/list/brand?brand='.$brandData['id'], | ||
76 | - 'thumb' => Helpers::getImageUrl($brandData['brand_ico'], 75, 40), | ||
77 | - 'name' => $brandData['brand_name'] | ||
78 | - ); | ||
79 | - | ||
80 | - // 设置品牌默认值 | ||
81 | - $data['goodList']['brand'] = $brandData['id']; | ||
82 | - } | ||
83 | - | ||
84 | - $data['goodList'] += ListProcess::getListData($tmpData); | ||
85 | - } | ||
86 | - | ||
87 | - $this->_view->display('index', $data); | ||
88 | - } | ||
89 | - | ||
90 | - | ||
91 | - /** | ||
92 | - * Ajax异步筛选请求 | ||
93 | - */ | ||
94 | - public function searchAction() | ||
95 | - { | ||
96 | - if($this->isAjax()) | ||
97 | - { | ||
98 | - $query = $this->get('query', null); | ||
99 | - $brand = $this->get('brand', null); | ||
100 | - $gender = $this->get('gender', null); | ||
101 | - $color = $this->get('color', null); | ||
102 | - $size = $this->get('size', null); | ||
103 | - $price = $this->get('price', null); | ||
104 | - $p_d = $this->get('discount', null); | ||
105 | - $sort = $this->get('msort', null); | ||
106 | - | ||
107 | - // 转换性别 | ||
108 | - $this->genderTrans($gender); | ||
109 | - | ||
110 | - // 转换排序方式 | ||
111 | - $order = $this->get('order', null); | ||
112 | - $type = $this->get('type', ''); | ||
113 | - switch ($type) { | ||
114 | - case 'price': | ||
115 | - $order = ($order == 0) ? 's_p_desc' : 's_p_asc'; | ||
116 | - break; | ||
117 | - case 'discount': | ||
118 | - $order = ($order == 0) ? 'p_d_desc' : 'p_d_asc'; | ||
119 | - break; | ||
120 | - case 'newest': | ||
121 | - default: | ||
122 | - $order = ($order == 0) ? 's_t_desc' : 's_t_asc'; | ||
123 | - break; | ||
124 | - } | ||
125 | - | ||
126 | - $data = array(); | ||
127 | - // 查询数据 | ||
128 | - $listData = SearchData::searchLiDatas($query, $brand, $gender, $color, $size, $price, $p_d, $sort, $order); | ||
129 | - // 处理返回的数据 | ||
130 | - if (isset($listData['code']) && $listData['code'] === 200) { | ||
131 | - $tmpData = $listData['data']; | ||
132 | - | ||
133 | - unset($tmpData['filter']);// 不要筛选条件的数据 | ||
134 | - $data = ListProcess::getListData($tmpData); | ||
135 | - } | ||
136 | - | ||
137 | - if(empty($data)) | ||
138 | - { | ||
139 | - echo ' '; | ||
140 | - } | ||
141 | - else | ||
142 | - { | ||
143 | - $this->_view->display('list', $data); | ||
144 | - } | ||
145 | - } | ||
146 | - } | ||
147 | - | ||
148 | - | ||
149 | - /** | ||
150 | - * 品牌商品列表页 | ||
151 | - */ | ||
152 | - public function brandAction() | ||
153 | - { | ||
154 | - $brand = $this->get('brand', null); | ||
155 | - $gender = $this->getCookie('_Channel', 'boys'); | ||
156 | - $sort = $this->get('sort', null); | ||
157 | - $color = $this->get('color', null); | ||
158 | - $size = $this->get('size', null); | ||
159 | - $price = $this->get('price', null); | ||
160 | - $p_d = $this->get('discount', null); | ||
161 | - | ||
162 | - $data = array( | ||
163 | - 'pageHeader' => array( | ||
164 | - 'navBack' => true, | ||
165 | - 'navHome' => '/' | ||
166 | - ), | ||
167 | - 'goodListPage' => true, | ||
168 | - 'goodList' => array( | ||
169 | - 'brandHome' => array( | ||
170 | - 'id' => $brand | ||
171 | - ), | ||
172 | - 'brand' => $brand, | ||
173 | - 'msort' => 0, | ||
174 | - 'gender' => $gender, | ||
175 | - 'sort' => 0, | ||
176 | - 'price' => 0, | ||
177 | - 'size' => 0, | ||
178 | - 'discount' => '', | ||
179 | - 'p_d' => '' | ||
180 | - ) | ||
181 | - ); | ||
182 | - | ||
183 | - // 获取品牌介绍信息 | ||
184 | - $introData = BrandData::getBrandIntro($brand); | ||
185 | - if(isset($introData['code']) && $introData['code'] === 200) | ||
186 | - { | ||
187 | - $data['goodList']['brandHome']['intro'] = isset($introData['data']['brand_intro']) ? $introData['data']['brand_intro'] : ''; | ||
188 | - } | ||
189 | - | ||
190 | - // 获取品牌banner的数据 | ||
191 | - $uid = $this->getUid(); | ||
192 | - $bannerData = BrandData::getBrandBanner($brand, $uid); | ||
193 | - if(isset($bannerData['code']) && $bannerData['code'] === 200) | ||
194 | - { | ||
195 | - $data['goodList']['brandHome']['banner'] = isset($bannerData['data']['banner']) ? Helpers::getImageUrl($bannerData['data']['banner'], 640, 75) : ''; | ||
196 | - } | ||
197 | - | ||
198 | - // 查询数据 | ||
199 | - // 转换性别 | ||
200 | - $this->genderTrans($gender); | ||
201 | - $listData = BrandData::selectBrandDetail($gender, $brand, $sort, $color, $size, $price, $p_d); | ||
202 | - // 处理返回的数据 | ||
203 | - if (isset($listData['code']) && $listData['code'] === 200) { | ||
204 | - $tmpData = $listData['data']; | ||
205 | - // 设置品牌名称 | ||
206 | - $data['pageHeader']['navTitle'] = isset($tmpData['brand_name']) ? $tmpData['brand_name'] : ''; | ||
207 | - | ||
208 | - $data['goodList'] += ListProcess::getListData($tmpData); | ||
209 | - } | ||
210 | - | ||
211 | - $this->_view->display('index', $data); | ||
212 | - } | ||
213 | - | ||
214 | - | ||
215 | - /** | ||
216 | - * 品类商品列表页 | ||
217 | - */ | ||
218 | - public function classAction() | ||
219 | - { | ||
220 | - $brand = $this->get('brand', null); | ||
221 | - $gender = $this->getCookie('_Channel', 'boys'); | ||
222 | - $sort = $this->get('sort', null); | ||
223 | - $color = $this->get('color', null); | ||
224 | - $size = $this->get('size', null); | ||
225 | - $price = $this->get('price', null); | ||
226 | - $p_d = $this->get('discount', null); | ||
227 | - | ||
228 | - $data = array( | ||
229 | - 'pageHeader' => array( | ||
230 | - 'navBack' => true, | ||
231 | - 'navHome' => '/' | ||
232 | - ), | ||
233 | - 'goodListPage' => true, | ||
234 | - 'goodList' => array( | ||
235 | - 'brand' => 0, | ||
236 | - 'msort' => 0, | ||
237 | - 'gender' => $gender, | ||
238 | - 'sort' => $sort, | ||
239 | - 'price' => 0, | ||
240 | - 'size' => 0, | ||
241 | - 'discount' => '' | ||
242 | - ) | ||
243 | - ); | ||
244 | - | ||
245 | - // 根据id查询类的名称 | ||
246 | - $classes = ClassModel::getClassesArr(); | ||
247 | - $data['pageHeader']['navTitle'] = isset($classes[$sort]) ? $classes[$sort] : ''; | ||
248 | - | ||
249 | - // 查询数据 | ||
250 | - // 转换性别 | ||
251 | - $this->genderTrans($gender); | ||
252 | - $listData = ClassData::selectClassDetail($gender, $brand, $sort, $color, $size, $price, $p_d); | ||
253 | - // 处理返回的数据 | ||
254 | - if (isset($listData['code']) && $listData['code'] === 200) { | ||
255 | - $tmpData = $listData['data']; | ||
256 | - | ||
257 | - $data['goodList'] += ListProcess::getListData($tmpData); | ||
258 | - } | ||
259 | - | ||
260 | - $this->_view->display('index', $data); | ||
261 | - } | ||
262 | - | ||
263 | - | ||
264 | - /** | ||
265 | - * 性别数据转换 | ||
266 | - * | ||
267 | - * @param string &$gender 从cookie中获取的gender值,最后得到转换之后接口调用的值 | ||
268 | - */ | ||
269 | - private function genderTrans(&$gender) | ||
270 | - { | ||
271 | - if($gender === 'boys') | ||
272 | - { | ||
273 | - $gender = '1,3'; | ||
274 | - } | ||
275 | - elseif($gender === 'girls') | ||
276 | - { | ||
277 | - $gender = '2,3'; | ||
278 | - } | ||
279 | - else | ||
280 | - { | ||
281 | - $gender = '1,2,3'; | ||
282 | - } | ||
283 | - } | ||
284 | - | ||
285 | -} |
1 | -; 默认页 | ||
2 | -routes.index.type = "rewrite" | ||
3 | -routes.index.match = "/index.html$" | ||
4 | -routes.index.route.module = Index | ||
5 | -routes.index.route.controller = Index | ||
6 | -routes.index.route.action = Index | ||
7 | - | ||
8 | -; 错误页 | ||
9 | -routes.error.type = "rewrite" | ||
10 | -routes.error.match = "/error.html$" | ||
11 | -routes.error.route.module = Index | ||
12 | -routes.error.route.controller = Error | ||
13 | -routes.error.route.action = Index | ||
14 | - | ||
15 | -; 注册页 | ||
16 | -routes.reg.type = "rewrite" | ||
17 | -routes.reg.match = "/reg.html$" | ||
18 | -routes.reg.route.module = Passport | ||
19 | -routes.reg.route.controller = Reg | ||
20 | -routes.reg.route.action = Index | ||
21 | - | ||
22 | -; 登录页 | ||
23 | -routes.login.type = "rewrite" | ||
24 | -routes.login.match = "/signin.html$" | ||
25 | -routes.login.route.module = Passport | ||
26 | -routes.login.route.controller = Login | ||
27 | -routes.login.route.action = Index | ||
28 | - | ||
29 | -; 登录页(国际账号) | ||
30 | -routes.interational.type = "rewrite" | ||
31 | -routes.interational.match = "/login.html$" | ||
32 | -routes.interational.route.module = Passport | ||
33 | -routes.interational.route.controller = Login | ||
34 | -routes.interational.route.action = International | ||
35 | - | ||
36 | -; 找回密码(手机号) | ||
37 | -routes.phoneback.type = "rewrite" | ||
38 | -routes.phoneback.match = "/phoneback.html$" | ||
39 | -routes.phoneback.route.module = Passport | ||
40 | -routes.phoneback.route.controller = Back | ||
41 | -routes.phoneback.route.action = Mobile | ||
42 | - | ||
43 | -; 找回密码(邮箱) | ||
44 | -routes.emailback.type = "rewrite" | ||
45 | -routes.emailback.match = "/emailback.html$" | ||
46 | -routes.emailback.route.module = Passport | ||
47 | -routes.emailback.route.controller = Back | ||
48 | -routes.emailback.route.action = Email | ||
49 | - | ||
50 | - |
-
Please register or login to post a comment