人人商城

Recycle.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. );
  14. protected $default = array(
  15. 'name' => '',
  16. 'type' => 0,
  17. );
  18. public function getByName($modulename) {
  19. return $this->query->where('name', $modulename)->get();
  20. }
  21. public function deleteByName($modulename) {
  22. return $this->query->where('name', $modulename)->delete();
  23. }
  24. public function addModule($modulename, $type = 1) {
  25. return $this->fill(array(
  26. 'name' => $modulename,
  27. 'type' => $type,
  28. ))->save();
  29. }
  30. public function searchWithModulesCloud() {
  31. return $this->query->from('modules_cloud', 'a')->select('a.*')->leftjoin('modules_recycle', 'b')->on(array('a.name' => 'b.name'));
  32. }
  33. public function searchWithModules() {
  34. return $this->query->from('modules', 'a')->select('a.*')->leftjoin('modules_recycle', 'b')->on(array('a.name' => 'b.name'));
  35. }
  36. }