Core.php 920 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Active\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 = 1;
  15. }
  16. if ($this->check) {
  17. $this->checkLogin();
  18. }
  19. if ($this->uid) {
  20. $this->user = Dever::db('active/user')->find($this->uid);
  21. // $this->user['uid'] = $this->user['id'];
  22. }
  23. if ($this->check) {
  24. if ($this->user) {
  25. $this->user['uid'] = $this->user['id'];
  26. }
  27. }
  28. }
  29. public function checkLogin()
  30. {
  31. if (!$this->uid || $this->uid <= 0) {
  32. Dever::alert('请先登录', -2);
  33. }
  34. }
  35. }