News.php 949 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. namespace We7\Table\Article;
  7. class News extends \We7Table {
  8. protected $tableName = 'article_news';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'cateid',
  12. 'title',
  13. 'content',
  14. 'thumb',
  15. 'source',
  16. 'author',
  17. 'displayorder',
  18. 'is_display',
  19. 'is_show_home',
  20. 'createtime',
  21. 'click',
  22. );
  23. protected $default = array(
  24. 'cateid' => 0,
  25. 'title' => '',
  26. 'content' => '',
  27. 'thumb' => '',
  28. 'source' => '',
  29. 'author' => '',
  30. 'displayorder' => 0,
  31. 'is_display' => 1,
  32. 'is_show_home' => 1,
  33. 'createtime' => 0,
  34. 'click' => 0,
  35. );
  36. public function searchWithCreatetimeRange($time) {
  37. return $this->where('createtime >=', strtotime("-{$time} days"));
  38. }
  39. public function searchWithTitle($title) {
  40. return $this->where('title LIKE', "%{$title}%");
  41. }
  42. }