token = $this->request->param('token','','trim'); if (!action_in_arr($this->noLogin)){ if($this->token=='')throw new \Exception('token不能为空',101); $this->Auth(); } } /**授权token鉴定 * @return \think\response\Json|void */ protected function Auth(){ $User = \app\common\User::instance(); $User->init($this->token); if (!$User->isLogin()) throw new \Exception($User->getError(),$User->getErroCode()); $this->uid = $User->id; $this->uname = $User->nickname; } }