| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 | 
							- <?php
 
- namespace Content\Lib;
 
- use Dever;
 
- class News
 
- {
 
-     # 获取几条数据
 
-     public function getHome($type = 1, $limit = 3, $page = 'article')
 
-     {
 
-         $where = array();
 
-         if ($type) {
 
-             $where['type'] = $type;
 
-         }
 
-         $where['limit'] = '0,' . $limit;
 
-         $data = Dever::db('content/news')->getHome($where);
 
-         if ($data) {
 
-             foreach ($data as $k => $v) {
 
-                 $data[$k] = $this->getOne($v);
 
-             }
 
-         }
 
-         return $data;
 
-     }
 
-     # 获取几条数据
 
-     public function getAll($type = 1, $name = '')
 
-     {
 
-         $where = array();
 
-         if ($type && $type > 0) {
 
-             $where['type'] = $type;
 
-         }
 
-         if($name) {
 
-             $where['name'] = $name;
 
-             $where['tag'] = $name;
 
-         }
 
-         $data = Dever::db('content/news')->getAll($where);
 
-         if ($data) {
 
-             foreach ($data as $k => $v) {
 
-                 $data[$k] = $this->getOne($v);
 
-             }
 
-         }
 
-         return $data;
 
-     }
 
-     public function getInfo($type, $id)
 
-     {
 
-         $where = array();
 
-         if ($type) {
 
-             $where['type'] = $type;
 
-         }
 
-         $data = Dever::db('content/news')->getOne($where);
 
-         if ($data) {
 
-             $data = $this->getOne($data);
 
-         }
 
-         return $data;
 
-     }
 
-     private function getOne($info)
 
-     {
 
-         $info['link'] = Dever::url('main/article?type='.$info['type'].'&id=' . $info['id']);
 
-         $info['pdate_string'] = date('M d, Y', $info['pdate']);
 
-         if ($info['author']) {
 
-             $info['pdate_string'] .= ' by ' . $info['author'];
 
-         }
 
-         $info['pdate_s'] = date('Y/m/d', $info['pdate']);
 
-         if ($info['video']) {
 
-             $info['video_info'] = Dever::qqvideo($info['video'], 2);
 
-             $info['video_id'] = isset($info['video_info'][1]) ? $info['video_info'][1] : 0;
 
-             $info['video_link'] = isset($info['video_info'][0]) ? $info['video_info'][0] : '';
 
-         } else {
 
-             $info['video_info'] = '';
 
-             $info['video_id'] = '';
 
-             $info['video_link'] = '';
 
-         }
 
-         $info['sname'] = $info['name'] . '<br />' . $info['desc'];
 
-         return $info;
 
-     }
 
- }
 
 
  |