Recycle.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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\Modules;
  7. class Recycle extends \We7Table {
  8. protected $tableName = 'modules_recycle';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'name',
  12. 'type',
  13. 'account_support',
  14. 'wxapp_support',
  15. 'welcome_support',
  16. 'webapp_support',
  17. 'phoneapp_support',
  18. 'xzapp_support',
  19. 'aliapp_support',
  20. 'baiduapp_support',
  21. 'toutiaoapp_support',
  22. );
  23. protected $default = array(
  24. 'name' => '',
  25. 'type' => 0,
  26. 'account_support' => 0,
  27. 'wxapp_support' => 0,
  28. 'welcome_support' => 0,
  29. 'webapp_support' => 0,
  30. 'phoneapp_support' => 0,
  31. 'xzapp_support' => 0,
  32. 'aliapp_support' => 0,
  33. 'baiduapp_support' => 0,
  34. 'toutiaoapp_support' => 0,
  35. );
  36. public function getByName($modulename, $key = 'type') {
  37. return $this->query->where('name', $modulename)->getall($key);
  38. }
  39. public function deleteByName($modulename) {
  40. return $this->query->where('name', $modulename)->delete();
  41. }
  42. public function searchWithNameType($name, $type) {
  43. $this->query->where('name', $name)->where('type', $type);
  44. return $this;
  45. }
  46. public function searchWithSupport($support) {
  47. $this->query->where($support, 1);
  48. return $this;
  49. }
  50. public function searchWithModulesCloud($fields = 'a.*') {
  51. return $this->query->from('modules_cloud', 'a')->select($fields)->leftjoin('modules_recycle', 'b')->on(array('a.name' => 'b.name'));
  52. }
  53. public function searchWithModules($fields = 'a.*') {
  54. return $this->query->from('modules', 'a')->select($fields)->leftjoin('modules_recycle', 'b')->on(array('a.name' => 'b.name'));
  55. }
  56. }