Article.php 726 B

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