Authored by tmq

分类

... ... @@ -10,7 +10,7 @@ class Controller_Video extends Controller_Abstract
$total = Facade_News::getTotal($tag);
$page = new Lib_Helper_Pagination($total, 24);
list($offset, $limit) = $page->getLimit();
$list = Facade_News::getList($tag, $offset, $limit);
$list = Facade_News::getVideoList($tag, $offset, $limit);
$this->_view['pagination'] = $page->getPagination();
$this->_view['list'] = $list;
}
... ...
... ... @@ -104,7 +104,20 @@ class Facade_News
*/
public static function getList($tag, $offset, $limit, $exceptTags = array())
{
return self::service()->getList($tag, $offset, $limit, $exceptTags);
return self::service()->getList($tag, $offset, $limit, $exceptTags,$type=0);
}
/**
* 获取视频信息
*
* @param string $tag
* @param int $offset
* @param int $limit
* @param array $exceptTags
* @return array
*/
public static function getVideoList($tag, $offset, $limit, $exceptTags = array())
{
return self::service()->getList($tag, $offset, $limit, $exceptTags,$type=1);
}
/**
... ...
... ... @@ -77,7 +77,7 @@ class Service_News extends Lib_Service
* @param array $exceptTags
* @return array
*/
public function getList($tag, $offset, $limit, $exceptTags)
public function getList($tag, $offset, $limit, $exceptTags,$type)
{
$where = '1' ;
$exceptWhere = '1';
... ... @@ -92,7 +92,11 @@ class Service_News extends Lib_Service
$tag = addslashes($tag);
$where = '`tag` like ("'.$tag.'%")' ;
}
$where = ' WHERE '.$where .' or is_video=1 AND '.$exceptWhere;
if($type==1) {
$where = ' WHERE ' . $where . ' or is_video=1 AND ' . $exceptWhere;
}else{
$where = ' WHERE ' . $where . ' AND ' . $exceptWhere;
}
return self::service(self::ROUTER)->tag(self::$_tag)->fetchAssoc('getList', array('offset' => intval($offset), 'limit' => intval($limit)), array('where' => $where));
}
... ...
... ... @@ -2,7 +2,7 @@
<?php $this->_block('main');?>
<div class="content-tab news-tab">
<ul class="clearfix">
<?php
<?php
array_unshift($this->view->tags, array('tag' => '', 'num'=> $this->view->total));
foreach ($this->view->tags as $tag):
if(empty($tag['num'])) continue;
... ...