Newsale.php
1.21 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
<?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');
// 新品到着商品数据
$productsData = Newsale::getNewsaleProducts('1,3', 1, 60);
var_dump($productsData);
// 处理返回的数据
$focus = array();
$products = array();
if($focusData['code'] === 200)
{
foreach ($focusData['data']['data'] as $single)
{
$single['src'] = Helpers::getImageUrl($val['src'], 375, 667, 1);
$focus[] = $single;
}
}
if($productsData['code'] === 200)
{
$products = $productsData['data'];
foreach ($products['product_list'] as &$val) {
$val['default_images'] = Helpers::getImageUrl($val['default_images'], 290, 386);
}
}
var_dump($products);exit;
$this->_view->display('new', compact('focus', 'products'));
}
}