Notice.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 Notice extends \We7Table {
  8. protected $tableName = 'article_notice';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'cateid',
  12. 'title',
  13. 'content',
  14. 'displayorder',
  15. 'is_display',
  16. 'is_show_home',
  17. 'createtime',
  18. 'click',
  19. 'style',
  20. 'group',
  21. );
  22. protected $default = array(
  23. 'cateid' => 0,
  24. 'title' => '',
  25. 'content' => '',
  26. 'displayorder' => 0,
  27. 'is_display' => 1,
  28. 'is_show_home' => 1,
  29. 'createtime' => 0,
  30. 'click' => 0,
  31. 'style' => '',
  32. 'group' => '',
  33. );
  34. public function getList() {
  35. $data = $this->getall();
  36. if (empty($data)) {
  37. return array();
  38. }
  39. foreach ($data as $key => $row) {
  40. $data[$key]['style'] = iunserializer($row['style']);
  41. $data[$key]['group'] = iunserializer($row['group']);
  42. }
  43. return $data;
  44. }
  45. public function searchWithCreatetimeRange($time) {
  46. return $this->where('createtime >=', strtotime("-{$time} days"));
  47. }
  48. public function searchWithTitle($title) {
  49. return $this->where('title LIKE', "%{$title}%");
  50. }
  51. public function searchWithIsDisplay() {
  52. return $this->where('is_display', 1);
  53. }
  54. }