Core.php 969 B

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