Core.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. $config = Dever::db('setting/base')->one();
  13. if($config['type'] == 2){
  14. Dever::alert($config['type_desc'], -4);
  15. }
  16. $this->uid = Dever::load('passport/user')->check(false);
  17. if ($this->uid <= 0) {
  18. //$this->uid = 4133;
  19. }
  20. if ($this->check) {
  21. $this->checkLogin();
  22. }
  23. if ($this->uid) {
  24. $this->user = Dever::db('agent/member')->find($this->uid);
  25. }
  26. if ($this->check) {
  27. if ($this->user && $this->user['status'] <= 2) {
  28. $this->user['uid'] = $this->user['id'];
  29. } else {
  30. Dever::alert('已被禁用', -3);
  31. }
  32. }
  33. }
  34. public function checkLogin()
  35. {
  36. if (!$this->uid || $this->uid <= 0) {
  37. Dever::alert('请先登录', -2);
  38. }
  39. }
  40. }