Newsale.php
5.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<?php
use Action\AbstractAction;
use LibModels\Wap\Product\NewsaleData;
use Plugin\Helpers;
/**
* 新品到着
*/
class NewsaleController extends AbstractAction
{
/**
* 新品到着
*
* @param int channel 1:男生,2:女生,3:潮童,4:创意生活
*/
public function indexAction()
{
$this->setTitle('新品到着');
$this->setNavHeader('新品到着');
$channel = Helpers::getChannelByCookie();
// 设置一些筛选的默认参数
$data = array(
'newArrivalPage' => true,
'showDownloadApp' => true,
'pageFooter' => true,
'headerBanner' => \Product\NewsaleModel::getNewFocus($channel),
'brand' => '0',
'sort' => '0',
'gender' => Helpers::getGenderByCookie(),
'price' => '0',
'size' => '0',
'dayLimit' => 1,
'discount' => '',
'cartUrl' => Helpers::url('/cart/index/index', null),
);
$this->_view->display('new', $data);
}
/**
* 折扣专区
*
* @param int channel 1:男生,2:女生,3:潮童,4:创意生活
*/
public function discountAction()
{
$this->setTitle('折扣专区');
$this->setNavHeader('Sale');
$channel = Helpers::getChannelByCookie();
// 设置一些默认参数
$data = array(
'discountPage' => true,
'headerBanner' => \Product\NewsaleModel::getSaleFocus($channel),
'showDownloadApp' => true,
'pageFooter' => true,
'brand' => '0',
'sort' => '0',
'gender' => Helpers::getGenderByCookie(),
'price' => '0',
'size' => '0',
'discount' => '0.1,0.9',
'cartUrl' => Helpers::url('/cart/index/index', null),
);
$this->_view->display('sale', $data);
}
/**
* 热销排行榜
*
* @param int channel 1:男生,2:女生,3:潮童,4:创意生活
*/
public function hotrankAction()
{
$this->setTitle('热销排行榜');
$this->setNavHeader('热销排行榜');
$channel = Helpers::getChannelByCookie();
// 设置一些默认参数
$data = array(
'discountPage' => true,
'headerBanner' => \Product\NewsaleModel::getNewFocus($channel),
'showDownloadApp' => true,
'pageFooter' => true,
'cartUrl' => Helpers::url('/cart/index/index', null),
);
$this->_view->display('hotrank', $data);
}
/**
* Ajax方式获取热销排行榜商品
*
* @return array 根据指定条件筛选之后的商品
*/
public function selectHotrankAction()
{
$result = array();
if ($this->isAjax()) {
$sort = $this->get('sort', null);
$tab_id = $this->get('tab_id', null);
$limit = $this->get('limit', 50);
$page = $this->get('page', 1);
// 获取性别
$gender = Helpers::getGenderByCookie();
$data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page);
$result = \Product\NewsaleModel::selectTopData($data);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('product', $result);
}
}
/**
* Ajax方式筛选新品到着、折扣专区商品
*
* @return array 根据指定条件筛选之后的商品
*/
public function selectNewSaleAction()
{
$result = array();
if ($this->isAjax()) {
$gender = $this->get('gender', null);
$brand = $this->get('brand', null);
$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);
$dayLimit = $this->get('dayLimit', null);
$limit = $this->get('limit', 60);
$page = $this->get('page', 1);
// 转换排序方式
$orderVal = $this->get('order', null);
$type = $this->get('type', '');
$order = Helpers::transOrder($orderVal, $type);
// 转换频道
$channel = Helpers::getChannelByCookie();
$data = NewsaleData::selectNewSaleProducts(
$gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order
);
$result = \Product\NewsaleModel::selectData($data);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('product', $result);
}
}
/**
* Ajax方式查询筛选数据
*
* @return array 筛选数据
*/
public function filterAction()
{
$result = array();
if ($this->isAjax()) {
$gender = $this->get('gender', null);
$brand = $this->get('brand', null);
$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);
$dayLimit = $this->get('dayLimit', null);
$limit = $this->get('limit', 60);
$page = $this->get('page', 1);
// 转换排序方式
$orderVal = $this->get('order', null);
$type = $this->get('type', '');
$order = Helpers::transOrder($orderVal, $type);
$channel = Helpers::getChannelByCookie();
$data = NewsaleData::selectNewSaleProducts(
$gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order
);
$result = \Product\NewsaleModel::filterData($data, $gender);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('filter', $result);
}
}
}