userRepository->findByUserName((string)$this->request->input('username')); if (!$adminInfo) throw new ErrException('后台管理员不存在'); if (! $adminInfo->verifyPassword((string) $this->request->input('password'))) { // $this->dispatcher->dispatch(new UserLoginEvent($user, $ip, $os, $browser, false)); throw new ErrException('密码错误'); } if ($adminInfo->status == AdminUserStatusCode::DISABLE) throw new ErrException('用户已禁用'); $jwtHandle = $this->tokenService->setJwt('admin')->getJwt(); return $this->adminReturn->success('success',[ 'access_token' => $jwtHandle->builderAccessToken((string) $adminInfo->id)->toString(), 'refresh_token' => $jwtHandle->builderRefreshToken((string) $adminInfo->id)->toString(), 'expire_at' => (int) $jwtHandle->getConfig('ttl', 0), ]); } }