Category.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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\Site;
  7. class Category extends \We7Table {
  8. protected $tableName = 'site_category';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'uniacid',
  12. 'nid',
  13. 'name',
  14. 'parentid',
  15. 'displayorder',
  16. 'enabled',
  17. 'icon',
  18. 'description',
  19. 'styleid',
  20. 'linkurl',
  21. 'ishomepage',
  22. 'icontype',
  23. 'css',
  24. 'multiid'
  25. );
  26. protected $default = array(
  27. 'uniacid' => 0,
  28. 'nid' => 0,
  29. 'name' => '',
  30. 'parentid' => 0,
  31. 'displayorder' => 0,
  32. 'enabled' => 1,
  33. 'icon' => '',
  34. 'description' => '',
  35. 'styleid' => '',
  36. 'linkurl' => '',
  37. 'ishomepage' => 0,
  38. 'icontype' => '',
  39. 'css' => '',
  40. 'multiid' => ''
  41. );
  42. public function getAllByUniacid($uniacid) {
  43. return $this->query->where('uniacid', $uniacid)->getall();
  44. }
  45. public function getBySnake($fields = '*', $where = array(), $order = array('id' => 'DESC')) {
  46. return $this->query()->select($fields)->where($where)->orderBy($where);
  47. }
  48. public function searchWithSiteArticle() {
  49. return $this->query->from($this->tableName, 'a')
  50. ->leftjoin('site_article', 'b')
  51. ->on(array('a.id' => 'b.pcate'));
  52. }
  53. }