Video.class.php
1.3 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
<?php
/**
* 默认控制器
*/
class Controller_Video extends Controller_Abstract
{
public function init()
{
header("location:".SITE_MAIN);
}
public function indexAction()
{
$ret = $this->_getVideoList();
$this->_view = $ret;
/***设置网站的SEO信息***/
$seo = C('APP.Seo');
$this->setTitle($seo['channel_video_title']);
$seo = null; unset($seo);
}
public function ajaxAction()
{
$ret = $this->_getVideoList();
$arr = array();
foreach ($ret['list'] as $val)
{
$arr[] = $val;
}
$ret['list'] = $arr;
return $this->returnJson(true,200,$ret);
}
private function _getVideoList()
{
$limit = 4;
$one = '';
$offset = intval($this->_request->query('offset',0));
$total = Facade_Video::getVideoTotal();
$list = Facade_Video::getVideo($offset, $limit);
$index=1;
foreach($list as $key=>$val)
{
$list[$key]['pic'] = Lib_Images::getImageUrl($val['pic'], '0209x0116','fragmentimg');
if($index==1)
{
$one = $val['url'] ;
}
$index++;
}
return array('list'=>$list,'offset'=>$offset,'total'=>$total,'one'=>$one);
}
}