Core.php 763 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace User\Lib;
  3. use Dever;
  4. class Core
  5. {
  6. protected $uid = -1;
  7. protected $login = true;
  8. public $data = array();
  9. public function __construct()
  10. {
  11. $this->uid = Dever::load('user/lib/info')->check(false);
  12. if ($this->uid <= 0) {
  13. $this->uid = Dever::db('user/info')->config['auto'];
  14. }
  15. $this->user = Dever::load('user/lib/info')->get($this->uid);
  16. if ($this->user) {
  17. $this->user['uid'] = $this->user['id'];
  18. }
  19. if ($this->login) {
  20. $this->checkLogin();
  21. }
  22. }
  23. public function checkLogin()
  24. {
  25. if (!$this->uid || $this->uid <= 0) {
  26. Dever::alert('请先登录', -2);
  27. }
  28. }
  29. }