增加了api文档

This commit is contained in:
2026-09-01 18:17:37 +08:00
parent e0e57a7eb4
commit 73e770db80
25 changed files with 913 additions and 140 deletions
+58
View File
@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>API 文档(全部)</title>
<link rel="stylesheet" href="swagger-ui.css">
<style>
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
body {
margin: 0;
background: #fafafa;
}
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script src="swagger-ui-bundle.js"></script>
<script src="swagger-ui-standalone-preset.js"></script>
<script>
window.onload = async function () {
let urls = [];
try {
const res = await fetch('urls');
if (res.ok) {
const list = await res.json();
if (Array.isArray(list) && list.length > 0) {
urls = list;
}
}
} catch (e) { }
if (urls.length === 0) {
document.getElementById('swagger-ui').innerHTML =
'<div style="padding:20px;color:#666;">无法加载文档列表,请确认服务正常运行。</div>';
return;
}
window.ui = SwaggerUIBundle({
urls: urls,
"urls.primaryName": urls[0].name,
dom_id: "#swagger-ui",
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
layout: "StandaloneLayout"
});
};
</script>
</body>
</html>
+40
View File
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>API 文档</title>
<link rel="stylesheet" href="swagger-ui.css">
<style>
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
body {
margin: 0;
background: #fafafa;
}
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script src="swagger-ui-bundle.js"></script>
<script>
window.onload = function () {
var path = window.location.pathname;
var match = path.match(/\/([^\/]+)\.html$/);
var id = match ? match[1] : 'api';
SwaggerUIBundle({
url: id + '.json',
dom_id: '#swagger-ui',
deepLinking: true,
presets: [SwaggerUIBundle.presets.apis]
});
};
</script>
</body>
</html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long