Newsale.php
2.7 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
<?php
use Action\AbstractAction;
use LibModels\wap\Product\NewsaleData as Newsale;
use Plugin\Helpers;
/**
* 新品到着
*/
class NewsaleController extends AbstractAction
{
public function indexAction()
{
$this->_view->assign('title', '新品到着');
// 新品到着顶部焦点图
$focusData = Newsale::getNewsaleFocus('a7989369aa86681c678bc40f171b8f1d');
// 处理返回的数据
$focus = array();
if($focusData['code'] == 200)
{
foreach ($focusData['data'] as $single)
{
foreach ($single['data'] as $val) {
$val['src'] = Helpers::getImageUrl($val['src'], 375, 667, 1);
$focus[] = $val;
}
}
}
// 批量获取新品到着商品数据
$products = Newsale::getNewProducts('1,3', 1, 60);
var_dump($focus);
$this->_view->display('new', compact('focus', 'products'));
}
/**
* Ajax方式筛选新品到着、折扣专区商品
*
* @return array 根据指定条件筛选之后的商品
*/
public function selectNewAction()
{
if($this->isAjax())
{
$gender = $this->get('gender', '1,3');
$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('p_d', null);
$channel = $this->get('channel', '1');
$dayLimit = $this->get('dayLimit', '1');
$limit = $this->get('limit', 50);
$page = $this->get('page', 1);
$data = Newsale::selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page);
$this->returnJson(200, '获取成功', $data);
}
}
public function discountAction()
{
$this->_view->assign('title', '折扣专区');
// 折扣专区顶部焦点图
$focusData = Newsale::getNewsaleFocus('e9c9be32d72e2906d404a72ee24cb523');
// 处理返回的数据
$focus = array();
if($focusData['code'] == 200)
{
foreach ($focusData['data'] as $single)
{
foreach ($single['data'] as $val) {
$val['src'] = Helpers::getImageUrl($val['src'], 375, 667, 1);
$focus[] = $val;
}
}
}
// 折扣专区商品数据
$products = Newsale::getNewProducts('1,3', 1, 60);
var_dump($products);
$this->_view->display('new', compact('focus', 'products'));
}
}