Core.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace Agent\Lib;
  3. use Dever;
  4. class Core
  5. {
  6. protected $uid = -1;
  7. protected $use = array();
  8. protected $check = true;
  9. public $data = array();
  10. public function __construct()
  11. {
  12. $test = Dever::input('test');
  13. $config = Dever::db('setting/base')->one();
  14. if($config['type'] == 2 || $test == 1){
  15. Dever::alert($config['type_desc'], -4);
  16. }
  17. $this->uid = Dever::load('passport/user')->check(false);
  18. if ($this->uid <= 0) {
  19. $this->uid = 4130;
  20. }
  21. if ($this->check) {
  22. $this->checkLogin();
  23. }
  24. if ($this->uid) {
  25. $this->user = Dever::db('agent/member')->find($this->uid);
  26. }
  27. if ($this->check) {
  28. if ($this->user && $this->user['status'] <= 2) {
  29. $this->user['uid'] = $this->user['id'];
  30. } else {
  31. Dever::alert('已被禁用', -3);
  32. }
  33. }
  34. }
  35. public function checkLogin()
  36. {
  37. if (!$this->uid || $this->uid <= 0) {
  38. Dever::alert('请先登录', -2);
  39. }
  40. }
  41. }