Base.php 634 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\index\controller;
  3. use think\Controller;
  4. use think\Db;
  5. class Base extends Controller
  6. {
  7. protected $orgId = 4;
  8. protected $userId;
  9. public function __construct()
  10. {
  11. // 检查用户是否登录
  12. $this->orgId = input('orgId/d',0);
  13. $this->userId = input('userId/d',0);
  14. $token = input('token','','trim');
  15. $user = Db::name('token')->where(['user_id'=>$this->userId,'code'=>$token])->find();
  16. if(!$user){
  17. ajax_return_error('登录信息失效',100200);
  18. }
  19. $this->_initialize();
  20. }
  21. protected function _initialize(){}
  22. }