Lastuse.php 1.3 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\Users;
  7. class Lastuse extends \We7Table {
  8. protected $tableName = 'users_lastuse';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'uid',
  12. 'uniacid',
  13. 'modulename',
  14. 'type',
  15. );
  16. protected $default = array(
  17. 'uid' => '',
  18. 'uniacid' => '0',
  19. 'modulename' => '',
  20. 'type' => '',
  21. );
  22. public function getByType($type) {
  23. global $_W;
  24. $this->searchWithUid($_W['uid']);
  25. return $this->query->where('type', $type)->get();
  26. }
  27. public function searchWithoutType($type) {
  28. return $this->query->where('type <>', $type);
  29. }
  30. public function searchWithUniacid($uniacid) {
  31. return $this->query->where('uniacid', $uniacid);
  32. }
  33. public function searchWithUid($uid) {
  34. return $this->query->where('uid', $uid);
  35. }
  36. public function searchWithModule($module) {
  37. return $this->query->where('modulename', $module);
  38. }
  39. public function getDefaultModulesAccount() {
  40. global $_W;
  41. return $this->query
  42. ->select('m.uniacid as default_uniacid,m.modulename,m.uid,a.name as default_account_name')
  43. ->from($this->tableName, 'm')
  44. ->leftjoin('uni_account', 'a')
  45. ->on(array('m.uniacid' => 'a.uniacid'))
  46. ->where('m.uid', $_W['uid'])
  47. ->getall('modulename');
  48. }
  49. }