Brand.class.php
1.02 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
<?php
/**
* 默认控制器
*/
class Controller_Brand extends Controller_Abstract
{
public function indexAction()
{
$banners = Facade_Index::getIndex(3);
$this->_view['banners'] = $banners;
}
/**
* 详情页
*/
public function detailAction()
{
$id = intval($this->_request->id);
$info = Facade_Brand::getBrandbyID($id);
$relas = Facade_Brand::getBrandNewsRelaByBrandID($id);
$news = array();
foreach ($relas as $rela)
{
$new = Facade_News::getOneById($rela['news_id']);
if($new)
{
$news[] = $new;
}
}
$this->_view['info'] = $info;
$this->_view['news'] = $news;
}
/**
* 获取品牌
*
* @return json
*/
public function getbrandAction()
{
$brand = $this->_request->query('brand', '');
$list = Facade_Brand::getBrandByName($brand, 1);
return $this->returnJson(true, 200, $list);
}
}