Video.class.php 1.3 KB
<?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);
    }
    
}