Showing
3 changed files
with
20 additions
and
4 deletions
@@ -7,7 +7,7 @@ class Controller_Video extends Controller_Abstract | @@ -7,7 +7,7 @@ class Controller_Video extends Controller_Abstract | ||
7 | public function indexAction() | 7 | public function indexAction() |
8 | { | 8 | { |
9 | $tag = '视频'; | 9 | $tag = '视频'; |
10 | - $total = Facade_News::getTotal($tag); | 10 | + $total = Facade_News::getvideoTotal($tag); |
11 | $page = new Lib_Helper_Pagination($total, 24); | 11 | $page = new Lib_Helper_Pagination($total, 24); |
12 | list($offset, $limit) = $page->getLimit(); | 12 | list($offset, $limit) = $page->getLimit(); |
13 | $list = Facade_News::getVideoList($tag, $offset, $limit); | 13 | $list = Facade_News::getVideoList($tag, $offset, $limit); |
@@ -76,7 +76,19 @@ class Facade_News | @@ -76,7 +76,19 @@ class Facade_News | ||
76 | */ | 76 | */ |
77 | public static function getTotal($conditions = array(), $exceptTags = array()) | 77 | public static function getTotal($conditions = array(), $exceptTags = array()) |
78 | { | 78 | { |
79 | - return self::service()->getTotal($conditions, $exceptTags); | 79 | + return self::service()->getTotal($conditions, $exceptTags,2); |
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * 获取视频总数 | ||
84 | + * | ||
85 | + * @param array $conditions | ||
86 | + * @param array $exceptTags | ||
87 | + * @return int | ||
88 | + */ | ||
89 | + public static function getvideoTotal($conditions = array(), $exceptTags = array()) | ||
90 | + { | ||
91 | + return self::service()->getTotal($conditions, $exceptTags,1); | ||
80 | } | 92 | } |
81 | 93 | ||
82 | /** | 94 | /** |
@@ -49,7 +49,7 @@ class Service_News extends Lib_Service | @@ -49,7 +49,7 @@ class Service_News extends Lib_Service | ||
49 | * @param array $exceptTags | 49 | * @param array $exceptTags |
50 | * @return int | 50 | * @return int |
51 | */ | 51 | */ |
52 | - public function getTotal($tag, $exceptTags) | 52 | + public function getTotal($tag, $exceptTags,$type) |
53 | { | 53 | { |
54 | $where = '1' ; | 54 | $where = '1' ; |
55 | $exceptWhere = '1'; | 55 | $exceptWhere = '1'; |
@@ -64,7 +64,11 @@ class Service_News extends Lib_Service | @@ -64,7 +64,11 @@ class Service_News extends Lib_Service | ||
64 | $tag = addslashes($tag); | 64 | $tag = addslashes($tag); |
65 | $where = '`tag` like ("'.$tag.'%")' ; | 65 | $where = '`tag` like ("'.$tag.'%")' ; |
66 | } | 66 | } |
67 | - $where = ' WHERE '.$where .' OR is_video=1 AND '.$exceptWhere; | 67 | + if($type==1) { |
68 | + $where = ' WHERE ' . $where . ' OR is_video=1 AND ' . $exceptWhere; | ||
69 | + }else{ | ||
70 | + $where = ' WHERE ' . $where . 'AND ' . $exceptWhere; | ||
71 | + } | ||
68 | return self::service(self::ROUTER)->tag(self::$_tag)->fetchOne('getTotal', array(),array('where' => $where)); | 72 | return self::service(self::ROUTER)->tag(self::$_tag)->fetchOne('getTotal', array(),array('where' => $where)); |
69 | } | 73 | } |
70 | 74 |
-
Please register or login to post a comment