Authored by tmq

加载

@@ -11,7 +11,7 @@ class Controller_Default extends Controller_Abstract @@ -11,7 +11,7 @@ class Controller_Default extends Controller_Abstract
11 public function indexAction() 11 public function indexAction()
12 { 12 {
13 $total = Facade_News::getTotal(array(), array('手机视频')); 13 $total = Facade_News::getTotal(array(), array('手机视频'));
14 - $page = new Lib_Helper_Pagination($total, 24); 14 + $page = new Lib_Helper_Pagination($total, 72);
15 $page->setOptions(array('afterAppend' => 'setLayout')); 15 $page->setOptions(array('afterAppend' => 'setLayout'));
16 list($offset, $limit) = $page->getLimit(); 16 list($offset, $limit) = $page->getLimit();
17 $this->_view['banners'] = Facade_Index::getIndex(1); 17 $this->_view['banners'] = Facade_Index::getIndex(1);
@@ -25,7 +25,8 @@ class Controller_Default extends Controller_Abstract @@ -25,7 +25,8 @@ class Controller_Default extends Controller_Abstract
25 $this->_view['partnerTypes'] = Facade_Partner::$types; 25 $this->_view['partnerTypes'] = Facade_Partner::$types;
26 $this->_view['pagination'] = $page->getPagination(); 26 $this->_view['pagination'] = $page->getPagination();
27 $this->_view['rightBanners'] = $rightBanners; 27 $this->_view['rightBanners'] = $rightBanners;
28 - $this->_view['news'] = $list; 28 + $data=array_slice($list,0,24);
  29 + $this->_view['news'] = $data;
29 } 30 }
30 31
31 /** 32 /**
@@ -85,4 +86,29 @@ class Controller_Default extends Controller_Abstract @@ -85,4 +86,29 @@ class Controller_Default extends Controller_Abstract
85 $this->_view['image'] = $dir.$val.'.jpg'; 86 $this->_view['image'] = $dir.$val.'.jpg';
86 $this->_viewname = 'wallpaperimagemobile'; 87 $this->_viewname = 'wallpaperimagemobile';
87 } 88 }
  89 +
  90 +
  91 + /**
  92 + * 首页加载资讯ajax接口
  93 + *
  94 + */
  95 + public function LoadNewsAction()
  96 + {
  97 + $total = Facade_News::getTotal(array(), array('手机视频'));
  98 + $page = new Lib_Helper_Pagination($total, 72);
  99 + $page->setOptions(array('afterAppend' => 'setLayout'));
  100 + list($offset, $limit) = $page->getLimit();
  101 + $list = Facade_News::getList(array(), $offset, $limit, array('手机视频'));
  102 + $type = $this->_request->query('type', null);
  103 + if($type==1){
  104 + $data=array_slice($list,0,24);
  105 + };
  106 + if($type==2){
  107 + $data=array_slice($list,24,24);
  108 + }
  109 + if($type==3){
  110 + $data=array_slice($list,48,24);
  111 + }
  112 + return json_encode($data);
  113 + }
88 } 114 }