Authored by tmq

bug

... ... @@ -7,7 +7,7 @@ class Controller_Video extends Controller_Abstract
public function indexAction()
{
$tag = '视频';
$total = Facade_News::getTotal($tag);
$total = Facade_News::getvideoTotal($tag);
$page = new Lib_Helper_Pagination($total, 24);
list($offset, $limit) = $page->getLimit();
$list = Facade_News::getVideoList($tag, $offset, $limit);
... ...
... ... @@ -76,7 +76,19 @@ class Facade_News
*/
public static function getTotal($conditions = array(), $exceptTags = array())
{
return self::service()->getTotal($conditions, $exceptTags);
return self::service()->getTotal($conditions, $exceptTags,2);
}
/**
* 获取视频总数
*
* @param array $conditions
* @param array $exceptTags
* @return int
*/
public static function getvideoTotal($conditions = array(), $exceptTags = array())
{
return self::service()->getTotal($conditions, $exceptTags,1);
}
/**
... ...
... ... @@ -49,7 +49,7 @@ class Service_News extends Lib_Service
* @param array $exceptTags
* @return int
*/
public function getTotal($tag, $exceptTags)
public function getTotal($tag, $exceptTags,$type)
{
$where = '1' ;
$exceptWhere = '1';
... ... @@ -64,7 +64,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)->fetchOne('getTotal', array(),array('where' => $where));
}
... ...