Default.class.php 2.76 KB
<?php
/**
 * 默认控制器
 */
class Controller_Default extends Controller_Abstract
{
    /**
     * 首页
     *
     */
    public function indexAction()
    {
    	$total = Facade_News::getTotal(array(), array('手机视频'));
    	$page = new Lib_Helper_Pagination($total, 96);
    	$page->setOptions(array('afterAppend' => 'setLayout'));
    	list($offset, $limit) = $page->getLimit();
		$this->_view['banners'] = Facade_Index::getIndex(1);
		$rightBanners = array();
		if(empty($offset))
		{
		    $rightBanners = Facade_Index::getIndex(2);
		}
	    $list = Facade_News::getList(array(), $offset, $limit, array('手机视频'));
		$this->_view['partnerList'] = Facade_Partner::getPartner();
		$this->_view['partnerTypes'] = Facade_Partner::$types;
		$this->_view['pagination'] = $page->getPagination();
		$this->_view['rightBanners'] = $rightBanners;
		$data=array_slice($list,0,24);
		$this->_view['news'] = $data;
    }
    
    /**
     * 客户端首页模块
     * 
     */
    public function indexMobileAction()
    {
        $this->_view['banners'] = Facade_Index::getIndex(1);
    }
    
    public function otherAction()
    {
    	
    }
    
    public function testAction()
    {
        $link = SITE_MAIN.url('default/test');
        $this->_view['wechat'] = Lib_Wechat_JSSDK::getSignPackage();
    }    
    public function contactusAction()
    {
    	
    }
    
    /**
     * 壁纸
     */
    public function wallpaperAction()
    {
    	$this->_viewname = 'wallpapermobile';
    }
    
    /**
     * 壁纸图片
     * 
     */
    public function wallpaperimageAction()
    {
    	$dir = SITE_IMG.'/yohood/wallpaper';
    	$screenWidth = $this->_request->query('width');
    	$screenHeight = $this->_request->query('height');
    	$val = $this->_request->query('val');
    	if($screenWidth >=1440 && $screenHeight>=1200)
    	{
    		$dir.='/1440x1200/';
    	}
    	else if($screenWidth >=640 && $screenHeight>=1136)
    	{
    		$dir.='/640x1136/';
    	}
    	else
    	{
    		$dir.='/640x960/';
    	}
    	$this->_view['image']  = $dir.$val.'.jpg';
    	$this->_viewname = 'wallpaperimagemobile';
    }


	/**
	 * 首页加载资讯ajax接口
	 *
	 */
	public function LoadNewsAction()
	{
		$total = Facade_News::getTotal(array(), array('手机视频'));
		$page = new Lib_Helper_Pagination($total, 72);
		$page->setOptions(array('afterAppend' => 'setLayout'));
		list($offset, $limit) = $page->getLimit();
		$list = Facade_News::getList(array(), $offset, $limit, array('手机视频'));
		$type = $this->_request->query('type', null);
		if($type==1){
			$data=array_slice($list,0,24);
		};
		if($type==2){
			$data=array_slice($list,24,24);
		}
		if($type==3){
			$data=array_slice($list,48,24);
		}
		if($type==4){
			$data=array_slice($list,72,24);
		}
		return json_encode($data);
	}
}