Core.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php namespace Place_interface\Lib;
  2. use Dever;
  3. use Place;
  4. use Dever\Helper\Secure;
  5. class Core
  6. {
  7. protected $login = false;
  8. protected $entry = false;
  9. public function __construct()
  10. {
  11. Place::init();
  12. $t = Dever::input('t');
  13. if ($this->login && !$t) {
  14. $this->showLogin();
  15. }
  16. if ($t) {
  17. if ($t = Secure::checkLogin($t)) {
  18. if ($t['uid'] && $t['uid'] > 0) {
  19. Place::user($t['uid']);
  20. }
  21. if ($this->login && !Place::$uid) {
  22. $this->showLogin();
  23. }
  24. } elseif ($this->login) {
  25. $this->showLogin();
  26. }
  27. }
  28. if ($this->entry) {
  29. if (Place::$info['type'] >= 2 && !Place::$uid) {
  30. Dever::error('您没有权限', -2);
  31. }
  32. /*
  33. if (Place::$member && Place::$user['entry_type'] <= 2) {
  34. Dever::error('您没有权限');
  35. }*/
  36. }
  37. }
  38. protected function showLogin()
  39. {
  40. Dever::error('请先登录', -4);
  41. }
  42. protected function showBindMobile()
  43. {
  44. if (Place::$user['type'] == 2) {
  45. Dever::error('您需要绑定手机号才能继续操作', -5);
  46. }
  47. }
  48. protected function showBindEmail()
  49. {
  50. if (Place::$user['type'] == 2) {
  51. Dever::error('您需要绑定邮箱才能继续操作', -6);
  52. }
  53. }
  54. # 获取要更新的数据版本号
  55. public function getUpdate()
  56. {
  57. return Place::$info['update'];
  58. }
  59. # 获取要更新的系统版本号
  60. public function getVersion()
  61. {
  62. return 100;
  63. }
  64. }