News.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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\Wechat;
  7. class News extends \We7Table {
  8. protected $tableName = 'wechat_news';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'uniacid',
  12. 'attach_id',
  13. 'thumb_media_id',
  14. 'thumb_url',
  15. 'title',
  16. 'author',
  17. 'digest',
  18. 'content',
  19. 'content_source_url',
  20. 'show_cover_pic',
  21. 'url',
  22. 'displayorder',
  23. 'need_open_comment',
  24. 'only_fans_can_comment',
  25. );
  26. protected $default = array(
  27. 'uniacid' => '0',
  28. 'attach_id' => '0',
  29. 'thumb_media_id' => '',
  30. 'thumb_url' => '',
  31. 'title' => '',
  32. 'author' => '',
  33. 'digest' => '',
  34. 'content' => '',
  35. 'content_source_url' => '',
  36. 'show_cover_pic' => '0',
  37. 'url' => '',
  38. 'displayorder' => '0',
  39. 'need_open_comment' => '1',
  40. 'only_fans_can_comment' => '1',
  41. );
  42. public function getAllByAttachId($attach_id) {
  43. return $this->query->where('attach_id', $attach_id)->orderby('displayorder', 'ASC')->getall();
  44. }
  45. public function searchKeyword($keyword) {
  46. return $this->query->where('title LIKE', $keyword)->whereor('author LIKE', $keyword)->whereor('digest LIKE', $keyword);
  47. }
  48. public function searchWithUniacid($uniacid) {
  49. return $this->query->where('uniacid', $uniacid);
  50. }
  51. }