<?php namespace app\index\controller; use think\Controller; use think\Db; class Base extends Controller { protected $orgId = 4; protected $userId; public function __construct() { // 检查用户是否登录 $this->orgId = input('orgId/d',0); $this->userId = input('userId/d',0); $token = input('token','','trim'); $user = Db::name('token')->where(['user_id'=>$this->userId,'code'=>$token])->find(); if(!$user){ ajax_return_error('登录信息失效',100200); } $this->_initialize(); } protected function _initialize(){} }