ExtraLimit.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 ExtraLimit extends \We7Table {
  8. protected $tableName = 'users_extra_limit';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'uid',
  12. 'maxaccount',
  13. 'maxwxapp',
  14. 'maxwebapp',
  15. 'maxphoneapp',
  16. 'maxxzapp',
  17. 'maxaliapp',
  18. 'maxbaiduapp',
  19. 'maxtoutiaoapp',
  20. 'timelimit',
  21. );
  22. protected $default = array(
  23. 'uid' => '0',
  24. 'maxaccount' => '0',
  25. 'maxwxapp' => '0',
  26. 'maxwebapp' => '0',
  27. 'maxphoneapp' => '0',
  28. 'maxxzapp' => '0',
  29. 'maxaliapp' => '0',
  30. 'maxbaiduapp' => '0',
  31. 'maxtoutiaoapp' => '0',
  32. 'timelimit' => '0',
  33. );
  34. public function getExtraLimitByUid($uid) {
  35. return $this->where(array('uid' => $uid))->get();
  36. }
  37. public function saveExtraLimit($data, $uid) {
  38. if (!empty($data['uid'])) {
  39. $update_res = $this->where(array('uid' => $data['uid']))->fill($data)->save();
  40. return $update_res;
  41. } else {
  42. $data['uid'] = $uid;
  43. $insert_res = $this->fill($data)->save();
  44. return $insert_res;
  45. }
  46. }
  47. }