From f9e10aa4ca28c75aeaa4447388b2fcd39ef5debb Mon Sep 17 00:00:00 2001 From: "2368302435@qq.com" <2368302435@qq.com> Date: Thu, 29 Feb 2024 00:34:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE=E5=BA=93=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=88=97=E8=A1=A8=E7=9A=84=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E7=BB=84=E4=BB=B6=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Ajax.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/admin/controller/Ajax.php b/app/admin/controller/Ajax.php index 45bc6b99..f677eb15 100644 --- a/app/admin/controller/Ajax.php +++ b/app/admin/controller/Ajax.php @@ -62,6 +62,27 @@ class Ajax extends Backend return response($content, 200, ['Content-Length' => strlen($content)])->contentType('image/svg+xml'); } + /** + * 获取已脱敏的数据库连接配置列表 + * @throws Throwable + */ + public function getDatabaseConnections(): void + { + $connections = config('database.connections'); + $desensitization = []; + foreach ($connections as $key => $connection) { + $connection = TableManager::getConnectionConfig($key); + $desensitization[] = [ + 'type' => $connection['type'], + 'database' => substr_replace($connection['database'], '****', 1, strlen($connection['database']) > 4 ? 2 : 1), + 'key' => $key, + ]; + } + $this->success('', [ + 'list' => $desensitization, + ]); + } + /** * 获取表主键字段 * @param ?string $table