Data.php 698 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php namespace Content\Lib;
  2. use Dever;
  3. class Data
  4. {
  5. # 获取内容信息
  6. public function get($data, $uid = false)
  7. {
  8. if (!is_array($data)) {
  9. $data = Dever::db('content/news')->getOne($data);
  10. }
  11. if (!$data) {
  12. Dever::alert('错误的文章信息');
  13. }
  14. return $data;
  15. }
  16. # 获取相关推荐
  17. public function getRelation($info)
  18. {
  19. $where['noid'] = $info['id'];
  20. $where['cate_id'] = $info['cate_id'];
  21. return Dever::db('content/news')->getRelation($where);
  22. }
  23. # 增加浏览量
  24. public function addView($id)
  25. {
  26. Dever::db('content/news')->addView($id);
  27. }
  28. }