Core.php 970 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace Main\Lib;
  3. use Dever;
  4. class Core
  5. {
  6. protected $uid = -1;
  7. protected $use = array();
  8. protected $data = array();
  9. public function __construct()
  10. {
  11. $this->uid = Dever::load('passport/user')->check(false);
  12. $this->uid = 1;
  13. if ($this->uid) {
  14. $this->user = Dever::load('passport/api')->info($this->uid);
  15. } else {
  16. $this->user = Dever::load('passport/user')->init();
  17. $this->uid = $this->user['id'];
  18. }
  19. if ($this->user) {
  20. $this->user['uid'] = $this->user['id'];
  21. }
  22. }
  23. public function checkLogin()
  24. {
  25. if (!$this->uid || $this->uid <= 0) {
  26. Dever::alert('请先登录', -2);
  27. }
  28. }
  29. public function alert($state)
  30. {
  31. if ($state) {
  32. return array('msg' => 'ok');
  33. } else {
  34. Dever::alert('操作失败');
  35. }
  36. }
  37. }