AccountMenus.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\Uni;
  7. class AccountMenus extends \We7Table {
  8. protected $tableName = 'uni_account_menus';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'uniacid',
  12. 'menuid',
  13. 'type',
  14. 'title',
  15. 'sex',
  16. 'group_id',
  17. 'client_platform_type',
  18. 'area',
  19. 'data',
  20. 'status',
  21. 'createtime',
  22. 'isdeleted',
  23. );
  24. protected $default = array(
  25. 'uniacid' => '0',
  26. 'menuid' => '0',
  27. 'type' => '1',
  28. 'title' => '',
  29. 'sex' => '0',
  30. 'group_id' => '-1',
  31. 'client_platform_type' => '0',
  32. 'area' => '',
  33. 'data' => '',
  34. 'status' => '0',
  35. 'createtime' => '0',
  36. 'isdeleted' => '0',
  37. );
  38. public function searchWithTypeAndUniacid($type = '', $uniacid = 0) {
  39. if (!empty($type)) {
  40. $this->where('type', $type);
  41. }
  42. if ($uniacid > 0) {
  43. $this->where('uniacid', intval($uniacid));
  44. }
  45. return $this;
  46. }
  47. public function getByType($type = '') {
  48. global $_W;
  49. return $this->searchWithTypeAndUniacid($type, $_W['uniacid'])->get();
  50. }
  51. public function getAllByType($type = '') {
  52. global $_W;
  53. return $this->searchWithTypeAndUniacid($type, $_W['uniacid'])->getall('id');
  54. }
  55. }