人人商城

Modules.php 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 Modules extends \We7Table {
  8. protected $tableName = 'modules';
  9. protected $primaryKey = 'mid';
  10. protected $field = array(
  11. 'name',
  12. 'type',
  13. 'title',
  14. 'title_initial',
  15. 'version',
  16. 'ability',
  17. 'description',
  18. 'author',
  19. 'url',
  20. 'settings',
  21. 'subscribes',
  22. 'handles',
  23. 'isrulefields',
  24. 'issystem',
  25. 'target',
  26. 'iscard',
  27. 'permissions',
  28. 'wxapp_support',
  29. 'account_support',
  30. 'welcome_support',
  31. 'webapp_support',
  32. 'xzapp_support',
  33. 'aliapp_support',
  34. 'oauth_type',
  35. 'phoneapp_support',
  36. );
  37. public function bindings() {
  38. return $this->hasMany('modules_bindings', 'module', 'name');
  39. }
  40. public function getByName($modulename) {
  41. if (empty($modulename)) {
  42. return array();
  43. }
  44. return $this->query->where('name', $modulename)->get();
  45. }
  46. public function getByNameList($modulename_list, $get_system = false) {
  47. $this->query->whereor('name', $modulename_list)->orderby('mid', 'desc');
  48. if (!empty($get_system)) {
  49. $this->whereor('issystem', 1);
  50. }
  51. return $this->query->getall('name');
  52. }
  53. public function deleteByName($modulename) {
  54. return $this->query->where('name', $modulename)->delete();
  55. }
  56. public function getByHasSubscribes() {
  57. return $this->query->select('name', 'subscribes')->where('subscribes !=', '')->getall();
  58. }
  59. public function getSupportWxappList() {
  60. return $this->query->where('wxapp_support', MODULE_SUPPORT_WXAPP)->getall('mid');
  61. }
  62. public function searchWithType($type, $method = '=') {
  63. if ($method == '=') {
  64. $this->query->where('type', $type);
  65. } else {
  66. $this->query->where('type <>', $type);
  67. }
  68. return $this;
  69. }
  70. public function searchWithRecycle() {
  71. return $this->query->from('modules', 'a')->select('a.*')->leftjoin('modules_recycle', 'b')->on(array('a.name' => 'b.name'))->where('a.issystem' , 0)->where('b.name', 'NULL')->orderby('a.mid', 'DESC')->getall('name');
  72. }
  73. }