Core.php 738 B

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