mirror of
https://gitee.com/wonderful-code/buildadmin
synced 2024-11-21 22:55:36 +00:00
feat:增加一个获取数据库连接配置列表的远程下拉组件接口
This commit is contained in:
parent
77af084385
commit
f9e10aa4ca
@ -62,6 +62,27 @@ class Ajax extends Backend
|
|||||||
return response($content, 200, ['Content-Length' => strlen($content)])->contentType('image/svg+xml');
|
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
|
* @param ?string $table
|
||||||
|
Loading…
Reference in New Issue
Block a user