encryptService = $encryptService; } #[OA\Get(path: '/system/security/api-encrypt/public-key', summary: '获取接口加密公钥', tags: ['system-security'])] #[DataResponse(description: '获取成功')] #[AllowAnonymous(requireToken: false, requirePermission: false, description: '公共接口')] public function publicKey(Request $request): Response { $publicKey = $this->encryptService->getPublicKey(); if ($publicKey === '') { return Json::fail('接口加密公钥未配置'); } return Json::success('获取成功', [ 'enabled' => $this->encryptService->isEnabled(), 'scope' => $this->encryptService->getScope(), 'algorithm' => $this->encryptService->getAlgorithm(), 'key_version' => $this->encryptService->getKeyVersion(), 'public_key' => $publicKey, ]); } }