diff --git a/.gitignore b/.gitignore
index d59dc5e..7bfb2fb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,5 +46,9 @@ build/
### VS Code ###
.vscode/
+### Python ###
+__pycache__/
+*.py[cod]
+
### Mac OS ###
.DS_Store
diff --git a/docs/api-integration.md b/docs/api-integration.md
index a000af3..2400b50 100644
--- a/docs/api-integration.md
+++ b/docs/api-integration.md
@@ -36,9 +36,11 @@ bash scripts/export-openapi.sh http://192.168.1.10:18092 docs/openapi.local.json
`docs/openapi.local.*` 是本地快照,已在 `.gitignore` 中忽略,不应提交。需要给远程 AI Agent 使用时,优先发送该文件,而不是 `localhost` 地址。
+导出脚本会同时生成面向 AI Agent 的接口索引 `docs/openapi.index.md`:按业务模块列出接口的方法、路径、摘要、参数、请求体与响应 schema。索引体积远小于完整 OpenAPI,适合先用于定位,再读取 OpenAPI 中的对应片段。PowerShell 使用 `-NoIndex`、Bash 使用 `SKIP_INDEX=1` 可跳过索引生成。
+
### 1.2 覆盖范围说明
-SpringDoc 会扫描项目中的全部 Controller,因此 OpenAPI 文件里会包含用户、标签、系统设置等模块的接口。本次只对文件模块与异步任务模块的 7 个 Controller 补充了完整的中文 `@Tag` / `@Operation` / `@Parameter` 描述;这些接口的路径、参数、请求体和响应结构均已包含在 OpenAPI 中。其他模块的接口属于 SpringDoc 自动生成的基础描述,业务语义可能不完整,复杂接口请结合源码或联调确认。
+SpringDoc 会扫描项目中的全部 Controller,因此 OpenAPI 文件里会包含用户、标签、系统设置等模块的接口。目前已对文件、异步任务与系统设置模块的 8 个 Controller 补充了完整的中文 `@Tag` / `@Operation` / `@Parameter` 描述;这些接口的路径、参数、请求体和响应结构均已包含在 OpenAPI 中。其他模块的接口属于 SpringDoc 自动生成的基础描述,业务语义可能不完整,复杂接口请结合源码或联调确认。
OpenAPI 中还声明了全局 `Token` 安全要求,但登录、注册等公开接口实际可能不需要登录。**是否需要鉴权以接口实际行为为准**;公开接口已在 OpenAPI 中按操作单独标记 `security`。
@@ -203,6 +205,15 @@ Accept-Language: zh-CN
具体哪些接口属于二进制响应,以 OpenAPI 中定义的响应 `Content-Type` 为准。
+#### 缩略图预览
+
+`GET /system/file/preview/{path}` 仅支持图片和视频,其他类型返回 `400`。图片和视频统一返回缩略图:
+
+- `size`:缩略图最大边长(像素),范围 `32-512`,默认 `256`
+- `v`:缓存版本号,建议传文件列表返回的 `etag`;传入后响应使用一年强缓存,不传时缓存一天
+- 响应 `Content-Type` 为 `image/jpeg` 或 `image/png`;PNG/GIF 源图使用 PNG,其余使用 JPEG
+- 支持 `If-None-Match` 条件请求,`ETag` 已包含缩略图尺寸和算法版本
+
### 3.2 SSE
部分长任务接口使用 `text/event-stream`,不经过 `TimiResponse`。事件类型如下:
@@ -241,7 +252,7 @@ source.addEventListener("done", (event) => {
## 4. AI Agent 对接建议
-1. **优先使用导出的 OpenAPI 文件**,不要只给 `localhost` URL。远程 Agent 无法访问本机地址。
+1. **优先使用导出的 OpenAPI 文件**,不要只给 `localhost` URL。远程 Agent 无法访问本机地址。可先读 `docs/openapi.index.md` 定位模块和接口,再读取 OpenAPI 中的对应片段,避免整份文档占用上下文。
2. 用 OpenAPI 生成 TypeScript 类型和请求客户端,再在客户端层统一补充 `TimiResponse` 包装。
3. 不要假设 OpenAPI 的返回类型就是最终响应体;普通 JSON 接口需要取 `data`。
4. 二进制接口单独处理:使用 `blob` / `arrayBuffer`,按 HTTP 状态判断成败。
@@ -265,7 +276,8 @@ code <= 30000 表示成功。鉴权使用 Token 请求头。
## 5. 已知限制
- OpenAPI 的响应 Schema 不包含 `TimiResponse` 包装。
-- 只有文件模块和异步任务模块的 7 个 Controller 有较完整的中文接口描述,其他模块为基础自动生成信息。
+- 只有文件、异步任务与系统设置模块的 8 个 Controller 有较完整的中文接口描述,其他模块为基础自动生成信息。
- 二进制接口的响应体无法在 OpenAPI 中完整表达,需结合本文和实际响应头处理。
- OpenAPI 全局声明了 `Token`,公开接口的实际鉴权行为以接口为准。
- 当前没有提交固定的 `docs/openapi.yaml` 版本化文件;需要时使用导出脚本生成本地快照,或后续接入 CI 导出。
+- `docs/openapi.index.md` 从本地 OpenAPI 快照生成,接口变更后需重新执行导出脚本更新;索引只提供定位信息,字段定义以 OpenAPI 原文为准。
diff --git a/docs/openapi.index.md b/docs/openapi.index.md
new file mode 100644
index 0000000..b65f32d
--- /dev/null
+++ b/docs/openapi.index.md
@@ -0,0 +1,814 @@
+# TimiServerAPI 接口索引
+
+> 本文件由 `scripts/openapi-index.py` 从 OpenAPI 快照生成,请勿手工编辑。
+> 数据来源:`docs/openapi.local.yaml`。完整字段定义以 OpenAPI 原文为准。
+
+- 服务版本:`1.0.79`
+- OpenAPI 版本:`3.1.0`
+- 路径数:464
+- 接口数:466(同一路径的同一处理器会合并多个 HTTP 方法)
+- 模块数:36
+
+## 使用说明
+
+- 先按模块定位接口,再读取 `docs/openapi.local.yaml` 中对应的 `path` 或 `components/schemas`,不要整文件加载。
+- 参数列中 `*` 表示必填;`header:`、`cookie:` 为参数位置前缀,其余为 path/query 参数。
+- 摘要前的 `[公开]` 表示 OpenAPI 中显式标记为无需登录;未标记的接口默认使用 `Token` 鉴权。
+- 方法列出现多个 HTTP 方法,表示 Controller 使用了未限定 method 的 `@RequestMapping`。
+- 请求体和响应列展示顶层 schema 名称;`binary` 表示二进制响应,`SSE` 表示 `text/event-stream`。
+- 普通 JSON 接口的响应仍由 `TimiResponse` 包装,鉴权、错误码、分页等约定见 `docs/api-integration.md`。
+
+## 模块导航
+
+| 模块 | 接口数 | 路径前缀 |
+| --- | ---: | --- |
+| [`gao-ai`](#module-gao-ai) | 8 | `/gao/ai/` |
+| [`gao-customer`](#module-gao-customer) | 41 | `/gao/customer/` |
+| [`gao-data-export`](#module-gao-data-export) | 3 | `/gao/data-export/` |
+| [`gao-event`](#module-gao-event) | 20 | `/gao/event/` |
+| [`gao-fund`](#module-gao-fund) | 5 | `/gao/fund/` |
+| [`gao-notify`](#module-gao-notify) | 2 | `/gao/notify/` |
+| [`gao-order`](#module-gao-order) | 13 | `/gao/order/` |
+| [`gao-package`](#module-gao-package) | 6 | `/gao/package/` |
+| [`gao-point`](#module-gao-point) | 11 | `/gao/point/` |
+| [`gao-product`](#module-gao-product) | 51 | `/gao/product/` |
+| [`gao-recycle`](#module-gao-recycle) | 32 | `/gao/recycle/` |
+| [`gao-report`](#module-gao-report) | 1 | `/gao/report/` |
+| [`gao-role`](#module-gao-role) | 2 | `/gao/role/` |
+| [`gao-sales`](#module-gao-sales) | 27 | `/gao/sales/` |
+| [`gao-store`](#module-gao-store) | 28 | `/gao/store/` |
+| [`gao-tag`](#module-gao-tag) | 7 | `/gao/tag/` |
+| [`gao-user`](#module-gao-user) | 10 | `/gao/user/` |
+| [`system`](#module-system) | 48 | `/system/` |
+| [`user`](#module-user) | 44 | `/user/` |
+| [`app`](#module-app) | 13 | `/app/` |
+| [`.well-known`](#module-.well-known) | 6 | `/.well-known/` |
+| [`article`](#module-article) | 5 | `/article/` |
+| [`attach`](#module-attach) | 14 | `/attach/` |
+| [`captcha`](#module-captcha) | 2 | `/captcha/` |
+| [`comment`](#module-comment) | 13 | `/comment/` |
+| [`feedback`](#module-feedback) | 5 | `/feedback/` |
+| [`fmc`](#module-fmc) | 1 | `/fmc/` |
+| [`icon`](#module-icon) | 4 | `/icon/` |
+| [`journal`](#module-journal) | 7 | `/journal/` |
+| [`log`](#module-log) | 1 | `/log/` |
+| [`mcp`](#module-mcp) | 5 | `/mcp/` |
+| [`mirror`](#module-mirror) | 2 | `/mirror/` |
+| [`notify`](#module-notify) | 15 | `/notify/` |
+| [`root`](#module-root) | 1 | `/` |
+| [`setting`](#module-setting) | 6 | `/setting/` |
+| [`tag`](#module-tag) | 7 | `/tag/` |
+
+
+## gao-ai
+
+共 8 个接口,路径前缀 `/gao/ai/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/ai/attachment/upload` | upload | storeId | object{file} (multipart/form-data) | Array | gao-ai-operation-controller |
+| POST | `/gao/ai/chat` | chat | - | GaoAiChatRequest | SSE | gao-ai-chat-controller |
+| POST | `/gao/ai/conversation/delete` | deleteConversation | conversationId* | - | - | gao-ai-chat-controller |
+| POST | `/gao/ai/conversation/list` | listConversation | - | GaoAiConversationListRequest | JsonNode | gao-ai-chat-controller |
+| POST | `/gao/ai/conversation/read` | readConversation | - | GaoAiConversationReadRequest | JsonNode | gao-ai-chat-controller |
+| POST | `/gao/ai/operation/cancel` | cancel | - | GaoAiOperationCommitRequest | GaoAiToolResult | gao-ai-operation-controller |
+| POST | `/gao/ai/operation/commit` | commit | - | GaoAiOperationCommitRequest | GaoAiToolResult | gao-ai-operation-controller |
+| GET | `/gao/ai/operation/pending` | pending | conversationId, storeId | - | GaoAiToolResult | gao-ai-operation-controller |
+
+
+## gao-customer
+
+共 41 个接口,路径前缀 `/gao/customer/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/customer/chart/customer/disease/word` | customerDiseaseWord | - | GaoCustomerDiseaseWordReq | Array | gao-customer-chart-controller |
+| POST | `/gao/customer/chart/event/record/calendar` | eventRecordCalendar | - | GaoCustomerChartReq | Array | gao-customer-chart-controller |
+| POST | `/gao/customer/chart/event/record/daily` | eventRecordDaily | - | GaoCustomerChartReq | Array | gao-customer-chart-controller |
+| POST | `/gao/customer/consumption-record/list` | list | - | GaoCustomerConsumptionRecordPage | GaoCustomerConsumptionRecordPageResult | gao-customer-consumption-record-controller |
+| POST | `/gao/customer/create` | create | - | GaoCustomer_Public | string | gao-customer-controller |
+| POST | `/gao/customer/delete` | delete | id* | - | - | gao-customer-controller |
+| POST | `/gao/customer/detail` | detail | id* | - | GaoCustomer_Public | gao-customer-controller |
+| POST | `/gao/customer/find/code` | findByCode | storeId*, code* | - | GaoCustomer_Public | gao-customer-controller |
+| POST | `/gao/customer/find/id` | findById | id* | - | GaoCustomer_Public | gao-customer-controller |
+| POST | `/gao/customer/find/name` | findByName | storeId*, name* | - | GaoCustomer_Public | gao-customer-controller |
+| POST | `/gao/customer/follow-up-reminder/complete` | complete | id* | - | - | gao-customer-follow-up-reminder-controller |
+| POST | `/gao/customer/follow-up-reminder/create` | create | - | GaoCustomerFollowUpReminder | string | gao-customer-follow-up-reminder-controller |
+| POST | `/gao/customer/follow-up-reminder/delete` | delete | id* | - | - | gao-customer-follow-up-reminder-controller |
+| POST | `/gao/customer/follow-up-reminder/detail` | detail | id* | - | GaoCustomerFollowUpReminder_Public | gao-customer-follow-up-reminder-controller |
+| POST | `/gao/customer/follow-up-reminder/list` | list | - | GaoCustomerFollowUpReminderPage_Public | GaoCustomerFollowUpReminderPageResult_Public | gao-customer-follow-up-reminder-controller |
+| POST | `/gao/customer/follow-up-reminder/update` | update | - | GaoCustomerFollowUpReminder | - | gao-customer-follow-up-reminder-controller |
+| POST | `/gao/customer/invite/delete` | deleteInvite | customerId* | - | - | gao-customer-controller |
+| POST | `/gao/customer/invite/save` | saveInvite | introducerCustomerId*, customerId* | - | - | gao-customer-controller |
+| POST | `/gao/customer/invited/list` | listInvited | introducerCustomerId* | - | Array | gao-customer-controller |
+| POST | `/gao/customer/list` | list | - | GaoCustomerPage_Public | PageResultGaoCustomer_Public | gao-customer-controller |
+| POST | `/gao/customer/package/cancel` | cancel | - | GaoCustomerPackageCancelRequest | GaoCustomerPackage | gao-customer-package-controller |
+| POST | `/gao/customer/package/detail` | detail | id* | - | GaoCustomerPackage | gao-customer-package-controller |
+| POST | `/gao/customer/package/list` | list | - | GaoCustomerPackagePage | PageResultGaoCustomerPackage | gao-customer-package-controller |
+| POST | `/gao/customer/package/purchase` | purchase | - | GaoCustomerPackagePurchaseRequest | GaoCustomerPackage | gao-customer-package-controller |
+| POST | `/gao/customer/point/account/detail` | detailById | id*, storeId | - | GaoPointAccount | gao-point-account-controller |
+| POST | `/gao/customer/point/account/detail/customer` | detail | customerId*, storeId | - | GaoPointAccount | gao-point-account-controller |
+| POST | `/gao/customer/point/account/list` | list | - | GaoPointAccountPage | PageResultGaoPointAccount | gao-point-account-controller |
+| POST | `/gao/customer/point/adjust` | adjust | - | GaoPointAdjustRequest | - | gao-point-ledger-controller |
+| POST | `/gao/customer/point/ledger/detail` | detail | id*, storeId | - | GaoPointLedger | gao-point-ledger-controller |
+| POST | `/gao/customer/point/ledger/list` | list | - | GaoPointLedgerPage | PageResultGaoPointLedger | gao-point-ledger-controller |
+| POST | `/gao/customer/point/rule/create` | create | - | GaoPointRule | string | gao-point-rule-controller |
+| POST | `/gao/customer/point/rule/delete` | delete | id* | - | - | gao-point-rule-controller |
+| POST | `/gao/customer/point/rule/detail` | detail | id* | - | GaoPointRule | gao-point-rule-controller |
+| POST | `/gao/customer/point/rule/list` | list | - | PageGaoPointRule | PageResultGaoPointRule | gao-point-rule-controller |
+| POST | `/gao/customer/point/rule/script/list` | scriptList | - | - | Array | gao-point-rule-controller |
+| POST | `/gao/customer/point/rule/sort` | sort | - | Array | - | gao-point-rule-controller |
+| POST | `/gao/customer/point/rule/update` | update | - | GaoPointRule | - | gao-point-rule-controller |
+| POST | `/gao/customer/profile/pdf` | pdf | id* | - | - | gao-customer-profile-controller |
+| POST | `/gao/customer/state/daily` | dailyStat | - | GaoCustomerTrendStateReq | Array | gao-customer-controller |
+| POST | `/gao/customer/state/gender` | genderStat | storeId* | - | Array | gao-customer-controller |
+| POST | `/gao/customer/update` | update | - | GaoCustomer | - | gao-customer-controller |
+
+
+## gao-data-export
+
+共 3 个接口,路径前缀 `/gao/data-export/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/data-export/stat` | stat | - | GaoDataExportStatRequest | GaoDataExportStatView | gao-data-export-controller |
+| POST | `/gao/data-export/task` | create | - | GaoDataExportCreateRequest | GaoDataExportTaskView | gao-data-export-controller |
+| GET | `/gao/data-export/task/{taskId}` | detail | taskId* | - | GaoDataExportTaskView | gao-data-export-controller |
+
+
+## gao-event
+
+共 20 个接口,路径前缀 `/gao/event/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/event/create` | create | - | GaoEvent | - | gao-event-controller |
+| POST | `/gao/event/delete` | delete | id* | - | - | gao-event-controller |
+| POST | `/gao/event/detail` | detail | id* | - | GaoEvent | gao-event-controller |
+| POST | `/gao/event/list` | list | - | PageGaoEvent | PageResultGaoEvent | gao-event-controller |
+| POST | `/gao/event/list/history` | listHistory | - | PageGaoEvent | PageResultGaoEvent | gao-event-controller |
+| POST | `/gao/event/list/valid` | listValid | storeId* | - | Array | gao-event-controller |
+| POST | `/gao/event/options/update` | updateOptions | id* | Array | - | gao-event-controller |
+| POST | `/gao/event/record/create` | create | - | GaoEventRecord | - | gao-event-record-controller |
+| POST | `/gao/event/record/create/batch` | createBatch | - | Array | - | gao-event-record-controller |
+| POST | `/gao/event/record/create/customer` | createWithCustomer | - | GaoCustomer | - | gao-event-record-controller |
+| POST | `/gao/event/record/delete` | delete | id* | - | - | gao-event-record-controller |
+| POST | `/gao/event/record/detail` | detail | id* | - | GaoEventRecord_Public | gao-event-record-controller |
+| POST | `/gao/event/record/list` | list | - | GaoEventRecordPage_Public | GaoEventRecordPageResult_Public | gao-event-record-controller |
+| POST | `/gao/event/record/month/pdf` | export | eventId*, month* | - | - | gao-event-month-export-controller |
+| POST | `/gao/event/record/option/stat` | optionStat | - | GaoEventRecordPage | Array | gao-event-record-controller |
+| POST | `/gao/event/record/rank` | eventRank | - | GaoEventRecordRankPage | PageResultGaoCustomerEventRankView | gao-event-record-controller |
+| POST | `/gao/event/record/update` | update | - | GaoEventRecord | - | gao-event-record-controller |
+| POST | `/gao/event/record/verify` | verify | id* | - | - | gao-event-record-controller |
+| POST | `/gao/event/sort` | sort | - | Array | - | gao-event-controller |
+| POST | `/gao/event/update` | update | - | GaoEvent | - | gao-event-controller |
+
+
+## gao-fund
+
+共 5 个接口,路径前缀 `/gao/fund/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/fund/record/detail` | detail | id* | - | GaoFundRecord | gao-fund-record-controller |
+| POST | `/gao/fund/record/list` | list | - | GaoFundRecordPage | PageResultGaoFundRecord | gao-fund-record-controller |
+| POST | `/gao/fund/record/my-receive/detail` | detailMyReceive | id* | - | GaoFundRecord | gao-fund-record-controller |
+| POST | `/gao/fund/record/my-receive/list` | listMyReceive | - | GaoFundRecordPage | PageResultGaoFundRecord | gao-fund-record-controller |
+| POST | `/gao/fund/record/revoke` | revoke | - | GaoFundRevokeRequest | GaoFundRecord | gao-fund-record-controller |
+
+
+## gao-notify
+
+共 2 个接口,路径前缀 `/gao/notify/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/notify/create` | create | - | Notify | Notify | gao-notify-controller |
+| POST | `/gao/notify/recipient/list` | recipientList | - | PageGaoUser_Public | PageResultGaoUser_Public | gao-notify-controller |
+
+
+## gao-order
+
+共 13 个接口,路径前缀 `/gao/order/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/order/fulfillment/cancel` | cancel | - | GaoOrderFulfillmentActionRequest | GaoOrderFulfillment | gao-order-fulfillment-controller |
+| POST | `/gao/order/fulfillment/create` | create | - | GaoOrderFulfillmentCreateRequest | GaoOrderFulfillment | gao-order-fulfillment-controller |
+| POST | `/gao/order/fulfillment/create-and-verify` | createAndVerify | - | GaoOrderFulfillmentCreateRequest | GaoOrderFulfillment | gao-order-fulfillment-controller |
+| POST | `/gao/order/fulfillment/detail` | detail | id* | - | GaoOrderFulfillment | gao-order-fulfillment-controller |
+| POST | `/gao/order/fulfillment/list` | list | - | GaoOrderFulfillmentPage | PageResultGaoOrderFulfillment | gao-order-fulfillment-controller |
+| POST | `/gao/order/fulfillment/prepare-stock` | prepareStock | - | GaoOrderFulfillmentPrepareStockRequest | GaoOrderFulfillment | gao-order-fulfillment-controller |
+| POST | `/gao/order/fulfillment/quick/create` | createQuickFulfillment | - | GaoQuickFulfillmentCreateRequest | Array | gao-order-fulfillment-controller |
+| POST | `/gao/order/fulfillment/quick/sku-list` | listQuickFulfillmentSku | - | GaoQuickFulfillmentCustomerRequest | Array | gao-order-fulfillment-controller |
+| POST | `/gao/order/fulfillment/quick/source-order-list` | listQuickFulfillmentSourceOrder | - | GaoQuickFulfillmentSourceOrderListRequest | Array | gao-order-fulfillment-controller |
+| POST | `/gao/order/fulfillment/reject` | reject | - | GaoOrderFulfillmentActionRequest | GaoOrderFulfillment | gao-order-fulfillment-controller |
+| POST | `/gao/order/fulfillment/return` | returnGoods | - | GaoOrderFulfillmentReturnRequest | GaoOrderFulfillment | gao-order-fulfillment-controller |
+| POST | `/gao/order/fulfillment/revoke` | revoke | - | GaoOrderFulfillmentRevokeRequest | GaoOrderFulfillment | gao-order-fulfillment-controller |
+| POST | `/gao/order/fulfillment/verify` | verify | - | GaoOrderFulfillmentActionRequest | GaoOrderFulfillment | gao-order-fulfillment-controller |
+
+
+## gao-package
+
+共 6 个接口,路径前缀 `/gao/package/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/package/config/create` | create | - | GaoPackageConfig | string | gao-package-config-controller |
+| POST | `/gao/package/config/delete` | delete | id* | - | - | gao-package-config-controller |
+| POST | `/gao/package/config/detail` | detail | id* | - | GaoPackageConfig | gao-package-config-controller |
+| POST | `/gao/package/config/list` | list | - | GaoPackageConfigPage | PageResultGaoPackageConfig | gao-package-config-controller |
+| POST | `/gao/package/config/list/valid` | listValid | storeId* | - | Array | gao-package-config-controller |
+| POST | `/gao/package/config/update` | update | - | GaoPackageConfig | - | gao-package-config-controller |
+
+
+## gao-point
+
+共 11 个接口,路径前缀 `/gao/point/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/point/redeem-sku/create` | create | - | GaoPointRedeemSkuRequest | GaoPointRedeemSku | gao-point-redeem-sku-controller |
+| POST | `/gao/point/redeem-sku/delete` | delete | id*, storeId | - | - | gao-point-redeem-sku-controller |
+| POST | `/gao/point/redeem-sku/detail` | detail | id*, storeId | - | GaoPointRedeemSku | gao-point-redeem-sku-controller |
+| POST | `/gao/point/redeem-sku/disable` | disable | id*, storeId | - | - | gao-point-redeem-sku-controller |
+| POST | `/gao/point/redeem-sku/list` | list | - | GaoPointRedeemSkuPage | GaoPointRedeemSkuPageResult | gao-point-redeem-sku-controller |
+| POST | `/gao/point/redeem-sku/update` | update | - | GaoPointRedeemSkuRequest | GaoPointRedeemSku | gao-point-redeem-sku-controller |
+| POST | `/gao/point/redemption/create` | create | - | GaoPointRedemptionCreateRequest | GaoPointRedemption | gao-point-redemption-controller |
+| POST | `/gao/point/redemption/detail` | detail | id*, storeId | - | GaoPointRedemption | gao-point-redemption-controller |
+| POST | `/gao/point/redemption/list` | list | - | GaoPointRedemptionPage | PageResultGaoPointRedemption | gao-point-redemption-controller |
+| POST | `/gao/point/redemption/return` | returnRedemption | - | GaoPointRedemptionReturnRequest | GaoPointRedemption | gao-point-redemption-controller |
+| POST | `/gao/point/redemption/return/list` | returnList | redemptionId*, storeId | - | Array | gao-point-redemption-controller |
+
+
+## gao-product
+
+共 51 个接口,路径前缀 `/gao/product/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/product/category/create` | categoryCreate | - | GaoProductCategory | string | gao-product-controller |
+| POST | `/gao/product/category/disable` | categoryDisable | id* | - | - | gao-product-controller |
+| POST | `/gao/product/category/list` | categoryList | - | GaoProductCategoryPage | PageResultGaoProductCategory | gao-product-controller |
+| POST | `/gao/product/category/sort` | categorySort | - | Array | - | gao-product-controller |
+| POST | `/gao/product/category/update` | categoryUpdate | - | GaoProductCategory | - | gao-product-controller |
+| POST | `/gao/product/chart/fulfillment/daily` | fulfillmentDaily | - | GaoProductChartReq | Array | gao-product-chart-controller |
+| POST | `/gao/product/chart/fulfillment/rank` | fulfillmentRank | - | GaoProductChartReq | Array | gao-product-chart-controller |
+| POST | `/gao/product/chart/sales/daily` | salesDaily | - | GaoProductChartReq | Array | gao-product-chart-controller |
+| POST | `/gao/product/chart/sales/rank` | salesRank | - | GaoProductChartReq | Array | gao-product-chart-controller |
+| POST | `/gao/product/chart/sales/unit/rank` | unitSalesRank | - | GaoProductChartReq | Array | gao-product-chart-controller |
+| POST | `/gao/product/chart/stock/health` | stockHealth | - | GaoProductChartReq | Array | gao-product-chart-controller |
+| POST | `/gao/product/chart/stock/movement/daily` | stockMovementDaily | - | GaoProductChartReq | Array | gao-product-chart-controller |
+| POST | `/gao/product/chart/structure/category` | category | - | GaoProductChartReq | Array | gao-product-chart-controller |
+| POST | `/gao/product/chart/structure/type` | type | - | GaoProductChartReq | Array | gao-product-chart-controller |
+| POST | `/gao/product/create` | create | - | GaoProduct | string | gao-product-controller |
+| POST | `/gao/product/delete` | delete | id* | - | - | gao-product-controller |
+| POST | `/gao/product/detail` | detail | id* | - | GaoProduct | gao-product-controller |
+| POST | `/gao/product/disable` | disable | id* | - | - | gao-product-controller |
+| POST | `/gao/product/list` | list | - | GaoProductPage | PageResultGaoProduct | gao-product-controller |
+| POST | `/gao/product/sellable/list` | sellableList | - | GaoProductPage | Array | gao-product-controller |
+| POST | `/gao/product/sku/chart/fulfillment/daily` | fulfillmentDaily | - | GaoProductChartReq | Array | gao-product-sku-chart-controller |
+| POST | `/gao/product/sku/chart/fulfillment/rank` | fulfillmentRank | - | GaoProductChartReq | Array | gao-product-sku-chart-controller |
+| POST | `/gao/product/sku/chart/sales/daily` | salesDaily | - | GaoProductChartReq | Array | gao-product-sku-chart-controller |
+| POST | `/gao/product/sku/chart/sales/rank` | salesRank | - | GaoProductChartReq | Array | gao-product-sku-chart-controller |
+| POST | `/gao/product/sku/chart/sales/unit/rank` | unitSalesRank | - | GaoProductChartReq | Array | gao-product-sku-chart-controller |
+| POST | `/gao/product/sku/chart/stock/health` | stockHealth | - | GaoProductChartReq | Array | gao-product-sku-chart-controller |
+| POST | `/gao/product/sku/chart/stock/movement/daily` | stockMovementDaily | - | GaoProductChartReq | Array | gao-product-sku-chart-controller |
+| POST | `/gao/product/sku/create` | skuCreate | - | GaoProductSku | string | gao-product-controller |
+| POST | `/gao/product/sku/detail` | skuDetail | id* | - | GaoProductSku | gao-product-controller |
+| POST | `/gao/product/sku/disable` | skuDisable | id* | - | - | gao-product-controller |
+| POST | `/gao/product/sku/fulfillment-list` | skuFulfillmentList | - | Array | Array | gao-product-controller |
+| POST | `/gao/product/sku/update` | skuUpdate | - | GaoProductSku | - | gao-product-controller |
+| POST | `/gao/product/spec/create` | specCreate | - | GaoProductSpec | string | gao-product-controller |
+| POST | `/gao/product/spec/list` | specList | productId* | - | Array | gao-product-controller |
+| POST | `/gao/product/spec/update` | specUpdate | - | GaoProductSpec | - | gao-product-controller |
+| POST | `/gao/product/spec/value/create` | specValueCreate | - | GaoProductSpecValue | string | gao-product-controller |
+| POST | `/gao/product/spec/value/update` | specValueUpdate | - | GaoProductSpecValue | - | gao-product-controller |
+| POST | `/gao/product/stock/batch-detail` | batchDetail | - | GaoProductStockBatchRequest | Array | gao-product-stock-controller |
+| POST | `/gao/product/stock/detail` | detail | storeId, skuId* | - | GaoProductStock | gao-product-stock-controller |
+| POST | `/gao/product/stock/initial-in` | initialIn | - | GaoProductStockChangeRequest | GaoProductStock | gao-product-stock-controller |
+| POST | `/gao/product/stock/list` | list | - | GaoProductStockPage | PageResultGaoProductStock | gao-product-stock-controller |
+| POST | `/gao/product/stock/manual-in` | manualIn | - | GaoProductStockChangeRequest | GaoProductStock | gao-product-stock-controller |
+| POST | `/gao/product/stock/manual-in/batch` | manualInBatch | - | GaoProductStockManualInBatchRequest | Array | gao-product-stock-controller |
+| POST | `/gao/product/stock/manual-out` | manualOut | - | GaoProductStockChangeRequest | GaoProductStock | gao-product-stock-controller |
+| POST | `/gao/product/stock/manual-revoke` | manualRevoke | - | GaoProductStockManualRevokeRequest | GaoProductStock | gao-product-stock-controller |
+| POST | `/gao/product/stock/product-list` | productList | - | GaoProductStockPage | PageResultGaoProductStockProductView | gao-product-stock-controller |
+| POST | `/gao/product/stock/record/detail` | recordDetail | id* | - | GaoProductStockRecord | gao-product-stock-controller |
+| POST | `/gao/product/stock/record/list` | recordList | - | GaoProductStockRecordPage | GaoProductStockRecordPageResult | gao-product-stock-controller |
+| POST | `/gao/product/stock/stocktake-gain` | stocktakeGain | - | GaoProductStockChangeRequest | GaoProductStock | gao-product-stock-controller |
+| POST | `/gao/product/stock/stocktake-loss` | stocktakeLoss | - | GaoProductStockChangeRequest | GaoProductStock | gao-product-stock-controller |
+| POST | `/gao/product/update` | update | - | GaoProduct | - | gao-product-controller |
+
+
+## gao-recycle
+
+共 32 个接口,路径前缀 `/gao/recycle/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/recycle/account/customers` | customers | - | GaoRecycleAccountCustomerPage | GaoRecycleAccountCustomerPageResult | gao-recycle-account-controller |
+| POST | `/gao/recycle/account/items` | accountItems | storeId* | - | Array | gao-recycle-account-controller |
+| POST | `/gao/recycle/account/list` | list | storeId*, customerId* | - | Array | gao-recycle-account-controller |
+| POST | `/gao/recycle/account/yield/delete` | deleteYield | storeId*, skuId*, recycleItemId* | - | - | gao-recycle-account-controller |
+| POST | `/gao/recycle/account/yield/list` | yields | storeId*, skuId* | - | Array | gao-recycle-account-controller |
+| POST | `/gao/recycle/account/yield/product/list` | yieldsByProduct | storeId*, productId* | - | Array | gao-recycle-account-controller |
+| POST | `/gao/recycle/account/yield/save` | saveYield | storeId*, skuId*, recycleItemId*, quantityPerBase* | - | - | gao-recycle-account-controller |
+| POST | `/gao/recycle/config/item/detail` | itemDetail | storeId, id* | - | GaoRecycleItem | gao-recycle-config-controller |
+| POST | `/gao/recycle/config/item/save` | saveItem | - | GaoRecycleItemRequest | GaoRecycleItem | gao-recycle-config-controller |
+| POST | `/gao/recycle/config/items` | items | storeId, status, keyword, offset, limit | - | PageResultGaoRecycleItem | gao-recycle-config-controller |
+| POST | `/gao/recycle/config/rule/delete` | deleteRule | storeId, id* | - | - | gao-recycle-config-controller |
+| POST | `/gao/recycle/config/rule/detail` | ruleDetail | storeId, id* | - | GaoRecycleExchangeRule | gao-recycle-config-controller |
+| POST | `/gao/recycle/config/rule/save` | saveRule | - | GaoRecycleExchangeRuleRequest | GaoRecycleExchangeRule | gao-recycle-config-controller |
+| POST | `/gao/recycle/config/rules` | rules | storeId, status, recycleItemId, skuId, keyword, offset, limit | - | PageResultGaoRecycleExchangeRule | gao-recycle-config-controller |
+| POST | `/gao/recycle/config/rules/active` | activeRules | storeId, recycleItemId, skuId, keyword, offset, limit | - | PageResultGaoRecycleExchangeRule | gao-recycle-config-controller |
+| POST | `/gao/recycle/exchange/create` | create | - | GaoRecycleExchangeCreateRequest | GaoRecycleExchange | gao-recycle-exchange-write-controller |
+| POST | `/gao/recycle/exchange/detail` | detail | id* | - | GaoRecycleExchangeDetail | gao-recycle-exchange-query-controller |
+| POST | `/gao/recycle/ledger/adjust` | adjust | - | GaoRecycleAccountAdjustRequest | - | gao-recycle-ledger-controller |
+| POST | `/gao/recycle/ledger/detail` | detail | id* | - | GaoRecycleLedger | gao-recycle-ledger-controller |
+| POST | `/gao/recycle/ledger/list` | list | - | GaoRecycleLedgerPage | PageResultGaoRecycleLedger | gao-recycle-ledger-controller |
+| POST | `/gao/recycle/payment/cancel` | cancel | - | GaoRecyclePaymentRequest | GaoRecyclePayment | gao-recycle-payment-controller |
+| POST | `/gao/recycle/payment/create` | create | - | GaoRecyclePaymentRequest | GaoRecyclePayment | gao-recycle-payment-controller |
+| POST | `/gao/recycle/payment/create-and-verify` | createAndVerify | - | GaoRecyclePaymentRequest | GaoRecyclePayment | gao-recycle-payment-controller |
+| POST | `/gao/recycle/payment/detail` | detail | id* | - | GaoRecyclePayment | gao-recycle-payment-controller |
+| POST | `/gao/recycle/payment/list` | list | orderId* | - | Array | gao-recycle-payment-controller |
+| POST | `/gao/recycle/payment/reject` | reject | - | GaoRecyclePaymentRequest | GaoRecyclePayment | gao-recycle-payment-controller |
+| POST | `/gao/recycle/payment/revoke` | revoke | - | GaoRecyclePaymentRequest | GaoRecyclePayment | gao-recycle-payment-controller |
+| POST | `/gao/recycle/payment/search` | search | storeId, customerId, orderId, status, beginAt, endAt, offset, limit | - | Array | gao-recycle-payment-controller |
+| POST | `/gao/recycle/payment/transactions` | transactions | orderId* | - | Array | gao-recycle-payment-controller |
+| POST | `/gao/recycle/payment/verify` | verify | - | GaoRecyclePaymentRequest | GaoRecyclePayment | gao-recycle-payment-controller |
+| POST | `/gao/recycle/stat/exchange` | exchange | storeId, startAt*, endAt* | - | Array | gao-recycle-stat-controller |
+| POST | `/gao/recycle/stat/recycle` | recycle | storeId, startAt*, endAt* | - | Array | gao-recycle-stat-controller |
+
+
+## gao-report
+
+共 1 个接口,路径前缀 `/gao/report/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/report/options/customers` | customers | storeId, keyword, offset | - | Array | gao-report-option-controller |
+
+
+## gao-role
+
+共 2 个接口,路径前缀 `/gao/role/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/role/available/list` | availableList | - | - | Array | gao-role-controller |
+| POST | `/gao/role/management/list` | managementList | - | - | Array | gao-role-controller |
+
+
+## gao-sales
+
+共 27 个接口,路径前缀 `/gao/sales/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/sales/order/cancel` | cancel | - | GaoSalesOrderCancelRequest | GaoSalesOrder | gao-sales-order-controller |
+| POST | `/gao/sales/order/chart/customer/calendar` | calendar | - | GaoSalesOrderChartReq | Array | gao-sales-order-chart-controller |
+| POST | `/gao/sales/order/chart/customer/consumption/daily` | consumptionDaily | - | GaoSalesOrderChartReq | Array | gao-sales-order-chart-controller |
+| POST | `/gao/sales/order/chart/customer/product/rank` | customerProductRank | - | GaoSalesOrderChartReq | Array | gao-sales-order-chart-controller |
+| POST | `/gao/sales/order/chart/customer/rank` | customerRank | - | GaoSalesOrderChartReq | Array | gao-sales-order-chart-controller |
+| POST | `/gao/sales/order/chart/customer/repeat/daily` | repeatDaily | - | GaoSalesOrderChartReq | Array | gao-sales-order-chart-controller |
+| POST | `/gao/sales/order/chart/customer/repeat/interval` | repeatInterval | - | GaoSalesOrderChartReq | Array | gao-sales-order-chart-controller |
+| POST | `/gao/sales/order/chart/customer/sku/rank` | customerSkuRank | - | GaoSalesOrderChartReq | Array | gao-sales-order-chart-controller |
+| POST | `/gao/sales/order/chart/daily` | daily | - | GaoSalesOrderChartReq | Array | gao-sales-order-chart-controller |
+| POST | `/gao/sales/order/chart/payment` | payment | - | GaoSalesOrderChartReq | Array | gao-sales-order-chart-controller |
+| POST | `/gao/sales/order/chart/receivable` | receivable | - | GaoSalesOrderChartReq | GaoSalesOrderReceivableStatView | gao-sales-order-chart-controller |
+| POST | `/gao/sales/order/chart/status` | status | - | GaoSalesOrderChartReq | Array | gao-sales-order-chart-controller |
+| POST | `/gao/sales/order/chart/type` | type | - | GaoSalesOrderChartReq | Array | gao-sales-order-chart-controller |
+| POST | `/gao/sales/order/customer-product/list` | customerProductList | - | GaoCustomerProductPage | PageResultGaoCustomerProductCustomerView | gao-sales-order-controller |
+| POST | `/gao/sales/order/detail` | detail | id* | - | GaoSalesOrder | gao-sales-order-controller |
+| POST | `/gao/sales/order/direct-product/create` | createDirectProduct | - | GaoDirectProductOrderCreateRequest | GaoSalesOrder | gao-sales-order-controller |
+| POST | `/gao/sales/order/fund/revoke` | revoke | - | GaoOrderPaymentRevokeRequest | GaoFundRecord | gao-sales-order-controller |
+| POST | `/gao/sales/order/list` | list | - | GaoSalesOrderPage | PageResultGaoSalesOrder | gao-sales-order-controller |
+| POST | `/gao/sales/order/payment/cancel` | cancelPayment | - | GaoOrderPaymentActionRequest | GaoFundRecord | gao-sales-order-controller |
+| POST | `/gao/sales/order/payment/receive` | receive | - | GaoOrderPaymentReceiveRequest | GaoFundRecord | gao-sales-order-controller |
+| POST | `/gao/sales/order/payment/receive-and-verify` | receiveAndVerify | - | GaoOrderPaymentReceiveRequest | GaoFundRecord | gao-sales-order-controller |
+| POST | `/gao/sales/order/payment/reject` | reject | - | GaoOrderPaymentActionRequest | GaoFundRecord | gao-sales-order-controller |
+| POST | `/gao/sales/order/payment/verify` | verify | id* | - | GaoFundRecord | gao-sales-order-controller |
+| POST | `/gao/sales/order/refund` | refund | - | GaoOrderPaymentRefundRequest | GaoFundRecord | gao-sales-order-controller |
+| POST | `/gao/sales/order/refund/confirm-none` | confirmNoRefund | - | GaoOrderPaymentNoRefundRequest | GaoFundRecord | gao-sales-order-controller |
+| POST | `/gao/sales/order/summary` | summary | - | GaoSalesOrderPage | GaoSalesOrderReceivableStatView | gao-sales-order-controller |
+| POST | `/gao/sales/order/update` | update | - | GaoSalesOrderUpdateRequest | GaoSalesOrder | gao-sales-order-controller |
+
+
+## gao-store
+
+共 28 个接口,路径前缀 `/gao/store/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/store/business/day/calendar` | calendar | storeId*, beginDateValue*, endDateValue* | - | Array | gao-store-business-day-controller |
+| POST | `/gao/store/business/day/create` | create | - | GaoStoreBusinessDay | string | gao-store-business-day-controller |
+| POST | `/gao/store/business/day/delete` | delete | id* | - | - | gao-store-business-day-controller |
+| POST | `/gao/store/business/day/detail` | detail | id* | - | GaoStoreBusinessDay | gao-store-business-day-controller |
+| POST | `/gao/store/business/day/list` | list | - | PageGaoStoreBusinessDay | PageResultGaoStoreBusinessDay | gao-store-business-day-controller |
+| POST | `/gao/store/business/day/update` | update | - | GaoStoreBusinessDay | - | gao-store-business-day-controller |
+| POST | `/gao/store/chart/customer/age` | customerAge | storeId* | - | Array | gao-store-chart-controller |
+| POST | `/gao/store/chart/customer/daily` | customerDaily | - | GaoStoreChartReq | Array | gao-store-chart-controller |
+| POST | `/gao/store/chart/customer/gender` | customerGender | storeId* | - | Array | gao-store-chart-controller |
+| POST | `/gao/store/chart/event/record/calendar` | eventRecordCalendar | - | GaoStoreChartReq | Array | gao-store-chart-controller |
+| POST | `/gao/store/chart/event/record/daily` | eventRecordDaily | - | GaoStoreChartReq | Array | gao-store-chart-controller |
+| POST | `/gao/store/chart/event/record/number-value/daily` | eventRecordNumberValueDaily | - | GaoStoreChartReq | Array | gao-store-chart-controller |
+| POST | `/gao/store/chart/point/ledger/daily` | pointDaily | - | GaoStoreChartReq | Array | gao-store-chart-controller |
+| POST | `/gao/store/chart/point/redemption/product/rank` | pointRedemptionProductRank | - | GaoStoreChartReq | Array | gao-store-chart-controller |
+| POST | `/gao/store/create` | create | - | GaoStore | string | gao-store-controller |
+| POST | `/gao/store/delete` | delete | id* | - | - | gao-store-controller |
+| POST | `/gao/store/detail` | detail | id* | - | GaoStore | gao-store-controller |
+| POST | `/gao/store/diary/create` | create | - | Article | string | gao-store-diary-controller |
+| POST | `/gao/store/diary/delete` | delete | id* | - | - | gao-store-diary-controller |
+| POST | `/gao/store/diary/detail` | detail | id* | - | Article_Public | gao-store-diary-controller |
+| POST | `/gao/store/diary/list` | list | - | GaoStoreDiaryPage_Public | PageResultArticle_Public | gao-store-diary-controller |
+| POST | `/gao/store/diary/update` | update | - | Article | - | gao-store-diary-controller |
+| POST | `/gao/store/list` | list | - | PageGaoStore | PageResultGaoStore | gao-store-controller |
+| POST | `/gao/store/setting/map` | map | - | Array | Map | gao-store-setting-controller |
+| POST | `/gao/store/setting/update` | update | - | Array | - | gao-store-setting-controller |
+| POST | `/gao/store/sort` | sort | - | Array | - | gao-store-controller |
+| POST | `/gao/store/update` | update | - | GaoStore | - | gao-store-controller |
+| POST | `/gao/store/user` | getLoginStore | - | - | GaoStore | gao-store-controller |
+
+
+## gao-tag
+
+共 7 个接口,路径前缀 `/gao/tag/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/tag/apply` | apply | - | TagApply | - | gao-tag-controller |
+| POST | `/gao/tag/create` | create | - | Tag_Public | Tag_Public | gao-tag-controller |
+| POST | `/gao/tag/delete` | delete | id* | - | - | gao-tag-controller |
+| POST | `/gao/tag/detail` | detail | id* | - | Tag_Public | gao-tag-controller |
+| POST | `/gao/tag/list` | list | - | PageTag_Public | PageResultTag_Public | gao-tag-controller |
+| GET | `/gao/tag/list/biz/id` | listByBizType | bizType*, bizId* | - | Array | gao-tag-controller |
+| POST | `/gao/tag/update` | update | - | Tag | - | gao-tag-controller |
+
+
+## gao-user
+
+共 10 个接口,路径前缀 `/gao/user/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/gao/user/create` | create | - | GaoUser_Public | GaoUser_Public | gao-user-controller |
+| POST | `/gao/user/delete` | delete | id* | - | - | gao-user-controller |
+| POST | `/gao/user/detail` | detail | id* | - | GaoUser_Public | gao-user-controller |
+| POST | `/gao/user/invite` | invite | - | GaoUserInviteCreateRequest | GaoUserInviteCreateResponse | gao-user-controller |
+| POST | `/gao/user/invite/register` | registerByInvite | - | GaoUserInviteRegisterRequest_Public | LoginResponse_Public | gao-user-controller |
+| POST | `/gao/user/invite/validate` | validateInvite | - | GaoUserInviteValidateRequest | GaoUserInviteValidateResponse | gao-user-controller |
+| POST | `/gao/user/list` | list | - | PageGaoUser_Public | PageResultGaoUser_Public | gao-user-controller |
+| POST | `/gao/user/role/list` | roleList | - | - | Array | gao-user-controller |
+| POST | `/gao/user/transfer/store` | transferStore | - | GaoUser_Public | GaoUser_Public | gao-user-controller |
+| POST | `/gao/user/update` | update | - | GaoUser_Public | GaoUser_Public | gao-user-controller |
+
+
+## system
+
+共 48 个接口,路径前缀 `/system/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| GET | `/system/docker/container` | listContainers | - | - | Array | docker-controller |
+| GET | `/system/docker/container/{containerId}/history` | getContainerHistory | containerId*, window | - | DockerContainerHistoryView | docker-controller |
+| GET | `/system/docker/container/{containerId}/status` | getContainerStatus | containerId* | - | DockerContainerStatusView | docker-controller |
+| POST | `/system/file/copy` | 创建复制任务 | - | ArchiveRequest | string | 系统-文件归档 |
+| POST | `/system/file/cut` | 创建移动任务 | - | ArchiveRequest | string | 系统-文件归档 |
+| POST | `/system/file/delete` | 删除到回收站 | - | FileListRequest | Array | 系统-文件回收站 |
+| GET/HEAD | `/system/file/download/{path}` | 下载文件 | path* | - | - | 系统-文件内容 |
+| GET | `/system/file/exist` | 判断路径是否存在 | path* | - | boolean | 系统-文件 |
+| GET | `/system/file/hash` | 计算文件 SHA-256 | path* | - | FileHash | 系统-文件 |
+| GET | `/system/file/list` | 获取目录列表 | path | - | Array | 系统-文件 |
+| POST | `/system/file/mkdir` | 创建目录 | - | MkdirRequest | ServerFile | 系统-文件 |
+| GET | `/system/file/object/{path}` | 获取文件属性 | path* | - | ServerFile | 系统-文件 |
+| GET | `/system/file/preview/{path}` | 预览文件 | path* | - | - | 系统-文件内容 |
+| GET | `/system/file/read/{path}` | 读取文件 | path* | - | - | 系统-文件内容 |
+| POST | `/system/file/rename` | 重命名或移动 | - | RenameRequest | ServerFile | 系统-文件 |
+| POST | `/system/file/search` | 搜索文件 | - | SearchRequest | SearchResult | 系统-文件 |
+| GET | `/system/file/share` | 获取分享列表 | - | - | Array | 系统-文件分享 |
+| POST | `/system/file/share` | 创建文件分享 | - | ShareCreateRequest | FileShare | 系统-文件分享 |
+| DELETE | `/system/file/share/{id}` | 取消文件分享 | id* | - | FileShare | 系统-文件分享 |
+| GET/HEAD | `/system/file/share/{token}/download` | [公开] 下载分享文件 | token*, password | - | - | 系统-文件分享 |
+| POST | `/system/file/size` | 统计目录大小 | - | PathRequest | string | 系统-文件 |
+| POST | `/system/file/tar` | 创建 TAR 压缩任务 | - | ArchiveRequest | string | 系统-文件归档 |
+| GET | `/system/file/trash` | 获取回收站列表 | - | - | Array | 系统-文件回收站 |
+| DELETE | `/system/file/trash` | 清空回收站 | - | - | integer | 系统-文件回收站 |
+| POST | `/system/file/trash/restore` | 恢复回收站文件 | - | IdRequest | ServerFile | 系统-文件回收站 |
+| DELETE | `/system/file/trash/{id}` | 彻底删除回收站记录 | id* | - | - | 系统-文件回收站 |
+| POST | `/system/file/untar` | 创建 TAR 解压任务 | - | UnarchiveRequest | string | 系统-文件归档 |
+| POST | `/system/file/unzip` | 创建 ZIP 解压任务 | - | UnarchiveRequest | string | 系统-文件归档 |
+| POST | `/system/file/upload` | 上传文件 | path*, name*, overwrite | object{file} | ServerFile | 系统-文件上传 |
+| POST | `/system/file/upload/chunk` | 上传分片 | uploadId*, index* | object{file} | - | 系统-文件上传 |
+| POST | `/system/file/upload/complete` | 完成分片上传 | - | UploadCompleteRequest | ServerFile | 系统-文件上传 |
+| POST | `/system/file/upload/init` | 初始化分片上传 | - | UploadInitRequest | UploadInit | 系统-文件上传 |
+| POST | `/system/file/zip` | 创建 ZIP 压缩任务 | - | ArchiveRequest | string | 系统-文件归档 |
+| POST | `/system/multilingual/create` | create | - | Multilingual_Admin | Multilingual_Admin | multilingual-controller |
+| POST | `/system/multilingual/delete` | delete | id* | - | - | multilingual-controller |
+| POST | `/system/multilingual/detail` | detail | id* | - | Multilingual_Admin | multilingual-controller |
+| POST | `/system/multilingual/update` | update | - | Multilingual | - | multilingual-controller |
+| GET | `/system/server/status` | getStatus | metrics | - | SystemStatusSnapshotView | system-controller |
+| GET | `/system/server/status/history` | getStatusHistory | window, metrics | - | SystemStatusHistoryView | system-controller |
+| POST | `/system/task/debug` | 创建调试任务 | second | - | string | 系统-异步任务 |
+| GET | `/system/task/detail` | 获取任务详情 | uuid* | - | AbstractAsyncTask | 系统-异步任务 |
+| GET | `/system/task/events` | 订阅任务事件 | uuid* | - | SSE | 系统-异步任务 |
+| POST | `/system/task/interrupt` | 中断任务 | uuid* | - | - | 系统-异步任务 |
+| POST | `/system/task/list` | 获取任务列表 | - | - | Array | 系统-异步任务 |
+| POST | `/system/task/pause` | 暂停任务 | uuid* | - | - | 系统-异步任务 |
+| POST | `/system/task/start` | 启动任务 | uuid* | - | - | 系统-异步任务 |
+| GET | `/system/ups/history` | getHistory | window | - | UpsHistoryView | ups-controller |
+| GET | `/system/ups/status` | getStatus | - | - | UpsStatusView | ups-controller |
+
+
+## user
+
+共 44 个接口,路径前缀 `/user/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/user/api-key/create` | create | - | CreateRequest | CreateResult | user-api-key-controller |
+| POST | `/user/api-key/delete` | delete | id* | - | - | user-api-key-controller |
+| POST | `/user/api-key/list` | list | - | - | Array | user-api-key-controller |
+| POST | `/user/api-key/revoke` | revoke | id* | - | - | user-api-key-controller |
+| POST | `/user/cancel` | cancel | - | CancelRequest | - | user-controller |
+| POST | `/user/create` | create | - | User | - | user-controller |
+| POST | `/user/current/update` | updateCurrent | - | User | LoginResponse | user-controller |
+| GET/HEAD/POST/PUT/PATCH/DELETE/OPTIONS | `/user/delete` | delete | id* | - | - | user-controller |
+| GET/HEAD/POST/PUT/PATCH/DELETE/OPTIONS | `/user/detail` | detail | id* | - | User | user-controller |
+| POST | `/user/list` | list | - | PageUser | PageResultUser | user-controller |
+| POST | `/user/login` | login | - | CaptchaDataLoginRequest_Public | LoginResponse_Public | user-controller |
+| POST | `/user/login/sms` | loginBySms | - | SmsCaptchaVerifyRequest_Public | LoginResponse_Public | user-controller |
+| GET/HEAD/POST/PUT/PATCH/DELETE/OPTIONS | `/user/login/token` | token | - | - | LoginResponse_Public | user-controller |
+| POST | `/user/logout` | logout | - | - | - | user-controller |
+| POST | `/user/permission/create` | create | - | Permission | - | permission-controller |
+| POST | `/user/permission/create/batch` | createBatch | - | BatchCreateReq | - | permission-controller |
+| POST | `/user/permission/delete` | delete | id* | - | - | permission-controller |
+| POST | `/user/permission/grantable/list` | listGrantable | moduleCode* | - | Array | permission-controller |
+| POST | `/user/permission/list` | list | - | PagePermission | PageResultPermission | permission-controller |
+| POST | `/user/permission/update` | update | - | Permission | - | permission-controller |
+| POST | `/user/phone/verify` | verifyPhone | - | PhoneVerifyRequest | - | user-controller |
+| POST | `/user/phone/verify/send` | sendPhoneCode | - | PhoneVerifyCodeSendRequest | - | user-controller |
+| POST | `/user/register` | register | - | CaptchaDataUser_Public | LoginResponse_Public | user-controller |
+| POST | `/user/role/authorized/create` | authorizeUserRole | - | UserRoleAuthorizeRequest | - | role-controller |
+| POST | `/user/role/authorized/list` | listUserRole | moduleCode, userId* | - | Array | role-controller |
+| POST | `/user/role/authorized/permission` | listAuthorizedPermission | userId* | - | Array | role-controller |
+| POST | `/user/role/create` | create | - | Role | - | role-controller |
+| POST | `/user/role/current/detail/list` | listCurrentRoleDetail | moduleCode | - | Array | role-controller |
+| POST | `/user/role/delegation/grantable/list` | listGrantableDelegationPermission | roleId* | - | Array | role-controller |
+| POST | `/user/role/delegation/list` | listDelegationPermission | roleId* | - | Array | role-controller |
+| POST | `/user/role/delegation/update` | updateRoleDelegation | - | Role | - | role-controller |
+| POST | `/user/role/delete` | delete | id* | - | - | role-controller |
+| POST | `/user/role/detail` | detail | id* | - | Role | role-controller |
+| POST | `/user/role/grantable/list` | listGrantableRole | moduleCode* | - | Array | role-controller |
+| POST | `/user/role/list` | list | - | PageRole | PageResultRole | role-controller |
+| POST | `/user/role/manageable/list` | listManageableRole | moduleCode* | - | Array | role-controller |
+| POST | `/user/role/parent/create/grantable/list` | listCreateGrantableParentRole | moduleCode* | - | Array | role-controller |
+| POST | `/user/role/parent/grantable/list` | listGrantableParentRole | roleId* | - | Array | role-controller |
+| POST | `/user/role/parent/update` | updateRoleParent | - | Role | - | role-controller |
+| POST | `/user/role/permission/grantable/list` | listGrantableRolePermission | roleId* | - | Array | role-controller |
+| POST | `/user/role/update` | update | - | Role | - | role-controller |
+| POST | `/user/update` | update | - | User | - | user-controller |
+| POST | `/user/update/email` | updateEmail | - | - | - | user-controller |
+| POST | `/user/update/password` | updatePassword | - | UpdatePasswordRequest | - | user-controller |
+
+
+## app
+
+共 13 个接口,路径前缀 `/app/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/app/channel/delete` | channelDelete | channelId* | - | - | app-release-controller |
+| GET | `/app/channel/list` | channelList | productId* | - | Array | app-release-controller |
+| POST | `/app/product/delete` | productDelete | productId* | - | - | app-release-controller |
+| POST | `/app/product/list` | productList | - | - | Array | app-release-controller |
+| POST | `/app/product/save` | productSave | - | AppProduct | AppProduct | app-release-controller |
+| POST | `/app/release/create` | releaseCreate | - | AppRelease | AppRelease | app-release-controller |
+| POST | `/app/release/delete` | releaseDelete | releaseId* | - | - | app-release-controller |
+| GET | `/app/release/list` | releaseList | productId* | - | Array | app-release-controller |
+| POST | `/app/release/publish` | publish | releaseId*, channelCode, grayPermille, note | - | - | app-release-controller |
+| POST | `/app/release/revoke` | revoke | releaseId* | - | - | app-release-controller |
+| POST | `/app/release/rollback` | rollback | productId*, channelCode, targetReleaseId* | - | - | app-release-controller |
+| POST | `/app/update/check` | check | - | AppUpdateCheckRequest | AppUpdateCheckResponse | app-update-controller |
+| POST | `/app/update/notes` | notes | - | AppUpdateCheckRequest | AppUpdateNotesResponse | app-update-controller |
+
+
+## .well-known
+
+共 6 个接口,路径前缀 `/.well-known/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| GET | `/.well-known/oauth-authorization-server` | notSupported | - | - | - | gao-ai-mcp-o-auth-discovery-controller |
+| GET | `/.well-known/oauth-authorization-server/mcp/gao-ai` | notSupported | - | - | - | gao-ai-mcp-o-auth-discovery-controller |
+| GET | `/.well-known/oauth-protected-resource` | notSupported | - | - | - | gao-ai-mcp-o-auth-discovery-controller |
+| GET | `/.well-known/oauth-protected-resource/mcp/gao-ai` | notSupported | - | - | - | gao-ai-mcp-o-auth-discovery-controller |
+| GET | `/.well-known/openid-configuration` | notSupported | - | - | - | gao-ai-mcp-o-auth-discovery-controller |
+| GET | `/.well-known/openid-configuration/mcp/gao-ai` | notSupported | - | - | - | gao-ai-mcp-o-auth-discovery-controller |
+
+
+## article
+
+共 5 个接口,路径前缀 `/article/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/article/create` | create | - | Article_Public | Article_Public | article-controller |
+| POST | `/article/delete` | delete | id* | - | - | article-controller |
+| GET/HEAD/POST/PUT/PATCH/DELETE/OPTIONS | `/article/detail` | detail | id* | - | Article_Public | article-controller |
+| POST | `/article/list` | list | - | PageArticle_Public | PageResultArticle_Public | article-controller |
+| POST | `/article/update` | update | - | Article | - | article-controller |
+
+
+## attach
+
+共 14 个接口,路径前缀 `/attach/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| GET | `/attach/count/biz` | countByBiz | bizType*, bizId*, attachTypeList | - | integer | attachment-controller |
+| POST | `/attach/create` | create | - | Attachment (multipart/form-data) | Attachment | attachment-controller |
+| POST | `/attach/delete` | delete | id* | - | - | attachment-controller |
+| POST | `/attach/detail` | detail | id* | - | Attachment | attachment-controller |
+| GET | `/attach/detail/byAttachType` | detailByAttachType | bizType*, bizId*, attachType* | - | Attachment | attachment-controller |
+| GET | `/attach/detail/byBiz` | detailByBiz | bizType*, bizId* | - | Attachment | attachment-controller |
+| GET | `/attach/download/{id}` | readById | id*, thumbWidth, thumbHeight, fitMode | - | - | attachment-controller |
+| GET | `/attach/list/biz` | listByBiz | bizType*, bizId*, attachTypeList | - | Array | attachment-controller |
+| POST | `/attach/page/biz` | pageByBiz | bizType*, bizId*, attachTypeList | PageAttachment | PageResultAttachment | attachment-controller |
+| GET | `/attach/read/{id}` | readById | id*, thumbWidth, thumbHeight, fitMode | - | - | attachment-controller |
+| GET | `/attach/temp/download` | read | id* | - | - | attachment-controller |
+| GET | `/attach/temp/read` | read | id* | - | - | attachment-controller |
+| POST | `/attach/temp/upload` | upload | file*, ttl | - | Array | attachment-controller |
+| POST | `/attach/update` | update | - | Attachment (multipart/form-data) | - | attachment-controller |
+
+
+## captcha
+
+共 2 个接口,路径前缀 `/captcha/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| GET | `/captcha` | captcha | width*, height* | - | Result | common-controller |
+| GET | `/captcha/img` | captchaImg | width*, height* | - | - | common-controller |
+
+
+## comment
+
+共 13 个接口,路径前缀 `/comment/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/comment/create` | create | - | CommentCreateReq_Public | Comment_Public | comment-controller |
+| POST | `/comment/delete` | delete | id*, userId* | - | - | comment-controller |
+| GET | `/comment/detail/tree` | detailTree | id*, currentUserId | - | Comment_Public | comment-controller |
+| GET | `/comment/flat/list` | listFlatRoot | bizType*, bizId*, offset, currentUserId | - | FlatCommentListResp_Public | comment-controller |
+| GET | `/comment/flat/thread` | getFlatThread | commentId*, offset, currentUserId | - | CommentThreadResp_Public | comment-controller |
+| POST | `/comment/layer/list` | listLayer | currentUserId | CommentLayerQueryReq_Public | CommentLayerResp_Public | comment-controller |
+| POST | `/comment/like` | like | commentId*, userId* | - | - | comment-controller |
+| POST | `/comment/like/list` | listLikedRecord | userId* | PageUserBehaviorRecord_Public | PageResultUserBehaviorRecord_Public | comment-controller |
+| GET | `/comment/nested/children` | getNestedChildren | commentId*, offset, currentUserId | - | CommentLayerResp_Public | comment-controller |
+| GET | `/comment/nested/detail` | getNestedDetail | commentId*, currentUserId | - | CommentNodeResp_Public | comment-controller |
+| GET | `/comment/nested/list` | listNestedRoot | bizType*, bizId*, offset, currentUserId | - | NestedCommentListResp_Public | comment-controller |
+| POST | `/comment/reply` | reply | - | CommentReplyReq_Public | Comment_Public | comment-controller |
+| POST | `/comment/unlike` | unlike | commentId*, userId* | - | - | comment-controller |
+
+
+## feedback
+
+共 5 个接口,路径前缀 `/feedback/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/feedback/create` | create | - | CaptchaDataFeedback_Public | - | feedback-controller |
+| POST | `/feedback/delete` | delete | id* | - | - | feedback-controller |
+| POST | `/feedback/detail` | detail | id* | - | Feedback_Admin | feedback-controller |
+| POST | `/feedback/list` | list | - | PageFeedback_Admin | PageResultFeedback_Admin | feedback-controller |
+| POST | `/feedback/update` | update | - | Feedback | - | feedback-controller |
+
+
+## fmc
+
+共 1 个接口,路径前缀 `/fmc/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/fmc/server/report` | report | - | - | - | server-controller |
+
+
+## icon
+
+共 4 个接口,路径前缀 `/icon/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| GET | `/icon/export/ttf` | exportTtf | - | - | - | icon-controller |
+| GET | `/icon/name/list` | listName | - | - | Array | icon-controller |
+| GET | `/icon/svg/map` | mapSvg | - | - | Map | icon-controller |
+| GET | `/icon/unicode/map` | mapUnicode | - | - | Map | icon-controller |
+
+
+## journal
+
+共 7 个接口,路径前缀 `/journal/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| GET | `/journal/tool/memo` | getMemo | - | - | string | tool-controller |
+| POST | `/journal/tool/memo/update` | updateMemo | data* | - | - | tool-controller |
+| POST | `/journal/travel/create` | create | - | Travel | - | travel-controller |
+| POST | `/journal/travel/delete` | delete | - | string | - | travel-controller |
+| POST | `/journal/travel/list` | list | - | PageTravel | PageResultTravel | travel-controller |
+| POST | `/journal/travel/update` | update | - | Travel | - | travel-controller |
+| GET | `/journal/travel/{id}` | detail | id* | - | Travel | travel-controller |
+
+
+## log
+
+共 1 个接口,路径前缀 `/log/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/log/create` | create | - | ClientLogRequest | - | logger-controller |
+
+
+## mcp
+
+共 5 个接口,路径前缀 `/mcp/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/mcp/gao-ai` | handle | header:Authorization, header:X-Timi-AI-Session | JsonNode | object | gao-ai-mcp-controller |
+| POST | `/mcp/gao-ai-commit` | handle | header:Authorization, header:X-Timi-AI-Session | JsonNode | object | gao-ai-mcp-commit-controller |
+| GET | `/mcp/gao-ai/.well-known/oauth-authorization-server` | notSupported | - | - | - | gao-ai-mcp-o-auth-discovery-controller |
+| GET | `/mcp/gao-ai/.well-known/oauth-protected-resource` | notSupported | - | - | - | gao-ai-mcp-o-auth-discovery-controller |
+| GET | `/mcp/gao-ai/.well-known/openid-configuration` | notSupported | - | - | - | gao-ai-mcp-o-auth-discovery-controller |
+
+
+## mirror
+
+共 2 个接口,路径前缀 `/mirror/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| GET | `/mirror/list` | list | - | - | Array | mirror-controller |
+| GET | `/mirror/{mirrorName}` | get | mirrorName* | - | JsonNode | mirror-controller |
+
+
+## notify
+
+共 15 个接口,路径前缀 `/notify/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/notify/cancel` | cancel | id* | - | - | notify-controller |
+| POST | `/notify/create` | create | - | Notify | Notify | notify-controller |
+| POST | `/notify/delete` | delete | id* | - | - | notify-controller |
+| GET/HEAD/POST/PUT/PATCH/DELETE/OPTIONS | `/notify/detail` | detail | id* | - | Notify_Public | notify-controller |
+| POST | `/notify/internal/delete` | deleteInternal | id* | - | - | notify-controller |
+| POST | `/notify/internal/detail` | internalDetail | id* | - | NotifyDetail_Public | notify-controller |
+| POST | `/notify/internal/internal` | listInternal | unreadOnly | PageNotifyDetail | PageResultNotifyDetail | notify-controller |
+| POST | `/notify/internal/read` | markSiteRead | id* | - | - | notify-controller |
+| POST | `/notify/internal/read/all` | markAllSiteRead | - | - | - | notify-controller |
+| POST | `/notify/internal/unread/count` | countUnreadSite | - | - | integer | notify-controller |
+| POST | `/notify/management/cancel` | managementCancel | id* | - | - | notify-controller |
+| POST | `/notify/management/delete` | managementDelete | id* | - | - | notify-controller |
+| POST | `/notify/management/detail` | managementDetail | id* | - | Notify_Admin | notify-controller |
+| POST | `/notify/management/list` | managementList | - | PageNotify_Admin | PageResultNotifyManagementItem_Admin | notify-controller |
+| POST | `/notify/sms/captcha/create` | smsCaptchaCreate | - | CaptchaDataNotify | string | notify-controller |
+
+
+## root
+
+共 1 个接口,路径前缀 `/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| GET/HEAD/POST/PUT/PATCH/DELETE/OPTIONS | `/` | root | - | - | string | common-controller |
+
+
+## setting
+
+共 6 个接口,路径前缀 `/setting/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/setting/create` | 创建配置 | - | Setting_Admin | Setting_Admin | 系统-配置 |
+| POST | `/setting/delete` | 删除配置 | - | string | - | 系统-配置 |
+| POST | `/setting/detail` | 查询配置详情 | - | string | Setting_Admin | 系统-配置 |
+| POST | `/setting/list` | 查询配置列表 | - | PageSetting_Admin | PageResultSetting_Admin | 系统-配置 |
+| GET/HEAD/POST/PUT/PATCH/DELETE/OPTIONS | `/setting/map` | [公开] 查询公开配置映射 | bizType*, bizId, code | - | Map | 系统-配置 |
+| POST | `/setting/update` | 更新配置 | - | Setting | - | 系统-配置 |
+
+
+## tag
+
+共 7 个接口,路径前缀 `/tag/`。
+
+| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |
+| --- | --- | --- | --- | --- | --- | --- |
+| POST | `/tag/apply` | apply | - | TagApply | - | tag-controller |
+| POST | `/tag/create` | create | - | Tag_Public | Tag_Public | tag-controller |
+| POST | `/tag/delete` | delete | id* | - | - | tag-controller |
+| POST | `/tag/detail` | detail | id* | - | Tag_Public | tag-controller |
+| POST | `/tag/list` | list | - | PageTag_Public | PageResultTag_Public | tag-controller |
+| GET | `/tag/list/biz/id` | listByBizType | bizType*, bizId* | - | Array | tag-controller |
+| POST | `/tag/update` | update | - | Tag | - | tag-controller |
diff --git a/pom.xml b/pom.xml
index 176f9d8..9bb166e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
com.imyeyu.timiserverapi
TimiServerAPI
- 1.0.80
+ 1.0.81
jar
TimiServerAPI
imyeyu.com API
diff --git a/scripts/export-openapi.ps1 b/scripts/export-openapi.ps1
index 900eaeb..04862dc 100644
--- a/scripts/export-openapi.ps1
+++ b/scripts/export-openapi.ps1
@@ -1,10 +1,11 @@
-<#
+<#
.SYNOPSIS
导出本地 OpenAPI 文档。
.DESCRIPTION
从本地已启动的服务获取 /v3/api-docs.yaml(或 JSON),写入 docs 目录。
- 生成的文件已被 .gitignore 忽略,不会提交。
+ 默认同时生成面向 AI Agent 的接口索引 docs/openapi.index.md。
+ 生成的 OpenAPI 快照已被 .gitignore 忽略;索引文件可按需提交或单独发送。
.PARAMETER BaseUrl
服务地址,默认 http://localhost:18092。
@@ -13,25 +14,41 @@
输出文件路径,默认 docs/openapi.local.yaml。
扩展名为 .json 时导出 JSON,否则导出 YAML。
+.PARAMETER IndexFile
+ 接口索引输出路径,默认 docs/openapi.index.md。
+
+.PARAMETER NoIndex
+ 跳过接口索引生成。
+
.EXAMPLE
.\scripts\export-openapi.ps1
.EXAMPLE
.\scripts\export-openapi.ps1 -BaseUrl http://192.168.1.10:18092 -OutFile docs/openapi.local.json
+
+.EXAMPLE
+ .\scripts\export-openapi.ps1 -NoIndex
#>
param(
[string]$BaseUrl = "http://localhost:18092",
- [string]$OutFile
+ [string]$OutFile,
+ [string]$IndexFile,
+ [switch]$NoIndex
)
$ErrorActionPreference = "Stop"
+$RootDir = Split-Path -Parent $PSScriptRoot
if ([string]::IsNullOrWhiteSpace($OutFile)) {
- $OutFile = Join-Path (Split-Path -Parent $PSScriptRoot) "docs\openapi.local.yaml"
+ $OutFile = Join-Path $RootDir "docs\openapi.local.yaml"
+}
+if ([string]::IsNullOrWhiteSpace($IndexFile)) {
+ $IndexFile = Join-Path $RootDir "docs\openapi.index.md"
}
$BaseUrl = $BaseUrl.TrimEnd("/")
$OutFile = [System.IO.Path]::GetFullPath($OutFile)
+$IndexFile = [System.IO.Path]::GetFullPath($IndexFile)
$OutDir = Split-Path -Parent $OutFile
if (-not (Test-Path -LiteralPath $OutDir)) {
@@ -48,3 +65,60 @@ $Url = "$BaseUrl$ApiPath"
Write-Host "Fetching $Url"
Invoke-WebRequest -Uri $Url -OutFile $OutFile -UseBasicParsing
Write-Host "OpenAPI exported to $OutFile"
+
+if ($NoIndex) {
+ exit 0
+}
+
+if ($IndexFile -eq $OutFile) {
+ Write-Warning "接口索引不能与 OpenAPI 输出文件相同,跳过接口索引生成。"
+ exit 0
+}
+
+$IndexScript = Join-Path $PSScriptRoot "openapi-index.py"
+if (-not (Test-Path -LiteralPath $IndexScript)) {
+ Write-Warning "未找到 $IndexScript,跳过接口索引生成。"
+ exit 0
+}
+
+$Python = $null
+foreach ($Candidate in @("python", "python3")) {
+ $Command = Get-Command $Candidate -ErrorAction SilentlyContinue
+ if ($Command) {
+ $Python = $Command.Source
+ break
+ }
+}
+if (-not $Python) {
+ Write-Warning "未找到 Python,跳过接口索引生成。安装 Python 或使用 -NoIndex 关闭该提示。"
+ exit 0
+}
+
+$IndexDir = Split-Path -Parent $IndexFile
+if (-not (Test-Path -LiteralPath $IndexDir)) {
+ New-Item -ItemType Directory -Path $IndexDir -Force | Out-Null
+}
+
+$IndexInput = $OutFile
+$TempIndexInput = $null
+if ([System.IO.Path]::GetExtension($OutFile) -ine ".json") {
+ $TempIndexInput = [System.IO.Path]::GetTempFileName()
+ try {
+ Invoke-WebRequest -Uri "$BaseUrl/v3/api-docs" -OutFile $TempIndexInput -UseBasicParsing
+ $IndexInput = $TempIndexInput
+ } catch {
+ Write-Warning "获取 OpenAPI JSON 失败,跳过接口索引生成:$($_.Exception.Message)"
+ $IndexInput = $null
+ }
+}
+
+if ($IndexInput) {
+ & $Python $IndexScript $IndexInput $IndexFile
+ if ($LASTEXITCODE -ne 0) {
+ Write-Warning "接口索引生成失败(退出码 $LASTEXITCODE)。"
+ }
+}
+
+if ($TempIndexInput -and (Test-Path -LiteralPath $TempIndexInput)) {
+ Remove-Item -LiteralPath $TempIndexInput -Force
+}
diff --git a/scripts/export-openapi.sh b/scripts/export-openapi.sh
index 595587d..22b6e11 100644
--- a/scripts/export-openapi.sh
+++ b/scripts/export-openapi.sh
@@ -1,17 +1,19 @@
#!/usr/bin/env bash
-# 导出本地 OpenAPI 文档。
+# 导出本地 OpenAPI 文档,并默认生成面向 AI Agent 的接口索引。
#
# 用法:
-# scripts/export-openapi.sh [baseUrl] [outFile]
+# scripts/export-openapi.sh [baseUrl] [outFile] [indexFile]
#
# 输出文件扩展名为 .json 时导出 JSON,否则导出 YAML。
-# 生成的文件已被 .gitignore 忽略,不会提交。
+# 索引默认输出到 docs/openapi.index.md;设置 SKIP_INDEX=1 可跳过。
+# 生成的 OpenAPI 快照已被 .gitignore 忽略;索引文件可按需提交或单独发送。
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
BASE_URL="${1:-http://localhost:18092}"
OUT_FILE="${2:-$ROOT_DIR/docs/openapi.local.yaml}"
+INDEX_FILE="${3:-$ROOT_DIR/docs/openapi.index.md}"
BASE_URL="${BASE_URL%/}"
mkdir -p "$(dirname "$OUT_FILE")"
@@ -28,3 +30,50 @@ esac
echo "Fetching ${BASE_URL}${API_PATH}"
curl -fsS "${BASE_URL}${API_PATH}" -o "$OUT_FILE"
echo "OpenAPI exported to $OUT_FILE"
+
+if [[ "${SKIP_INDEX:-0}" == "1" ]]; then
+ exit 0
+fi
+
+if [[ "$INDEX_FILE" == "$OUT_FILE" ]]; then
+ echo "warning: 接口索引不能与 OpenAPI 输出文件相同,跳过接口索引生成。" >&2
+ exit 0
+fi
+
+INDEX_SCRIPT="$ROOT_DIR/scripts/openapi-index.py"
+if [[ ! -f "$INDEX_SCRIPT" ]]; then
+ echo "warning: 未找到 $INDEX_SCRIPT,跳过接口索引生成。" >&2
+ exit 0
+fi
+
+PYTHON="$(command -v python3 2>/dev/null || command -v python 2>/dev/null || true)"
+if [[ -z "$PYTHON" ]]; then
+ echo "warning: 未找到 Python,跳过接口索引生成。安装 Python 或设置 SKIP_INDEX=1 关闭该提示。" >&2
+ exit 0
+fi
+
+INDEX_INPUT="$OUT_FILE"
+TEMP_JSON=""
+cleanup() {
+ if [[ -n "$TEMP_JSON" ]]; then
+ rm -f "$TEMP_JSON"
+ fi
+}
+trap cleanup EXIT
+
+if [[ "$OUT_FILE" != *.json ]]; then
+ TEMP_JSON="$(mktemp)"
+ if curl -fsS "${BASE_URL}/v3/api-docs" -o "$TEMP_JSON"; then
+ INDEX_INPUT="$TEMP_JSON"
+ else
+ echo "warning: 获取 OpenAPI JSON 失败,跳过接口索引生成。" >&2
+ INDEX_INPUT=""
+ fi
+fi
+
+if [[ -n "$INDEX_INPUT" ]]; then
+ mkdir -p "$(dirname "$INDEX_FILE")"
+ if ! "$PYTHON" "$INDEX_SCRIPT" "$INDEX_INPUT" "$INDEX_FILE"; then
+ echo "warning: 接口索引生成失败。" >&2
+ fi
+fi
diff --git a/scripts/openapi-index.py b/scripts/openapi-index.py
new file mode 100644
index 0000000..c459000
--- /dev/null
+++ b/scripts/openapi-index.py
@@ -0,0 +1,356 @@
+#!/usr/bin/env python3
+"""从 OpenAPI 文档生成供 AI Agent 使用的接口索引。
+
+默认优先读取 JSON(标准库即可解析);读取 YAML 时需要安装 PyYAML。
+导出脚本会优先传入 /v3/api-docs 的 JSON,避免额外依赖。
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import re
+import sys
+from pathlib import Path
+from typing import Any
+
+HTTP_METHODS = ("get", "head", "post", "put", "patch", "delete", "options", "trace")
+REQUEST_MEDIA = ("application/json", "multipart/form-data", "application/x-www-form-urlencoded", "*/*")
+RESPONSE_MEDIA = ("application/json", "*/*", "text/event-stream", "application/octet-stream")
+
+
+def load_spec(path: Path) -> dict[str, Any]:
+ text = path.read_text(encoding="utf-8")
+ try:
+ data = json.loads(text)
+ except json.JSONDecodeError:
+ try:
+ import yaml
+ except ImportError as exc:
+ raise SystemExit(
+ "无法解析 YAML:请安装 PyYAML(pip install pyyaml),"
+ "或改用 /v3/api-docs 的 JSON 输出。"
+ ) from exc
+ data = yaml.safe_load(text)
+ if not isinstance(data, dict):
+ raise SystemExit("OpenAPI 文档格式不正确:根节点必须是对象")
+ return data
+
+
+def resolve(spec: dict[str, Any], value: Any) -> Any:
+ """解析本地 $ref,最多跟随 32 层,避免循环引用。"""
+ for _ in range(32):
+ if not isinstance(value, dict) or "$ref" not in value:
+ return value
+ ref = value["$ref"]
+ if not isinstance(ref, str) or not ref.startswith("#/"):
+ return value
+ current: Any = spec
+ for part in ref[2:].split("/"):
+ part = part.replace("~1", "/").replace("~0", "~")
+ if not isinstance(current, dict) or part not in current:
+ return value
+ current = current[part]
+ value = current
+ return value
+
+
+def ref_name(ref: str) -> str:
+ return ref.rsplit("/", 1)[-1].replace("~1", "/").replace("~0", "~")
+
+
+def schema_label(spec: dict[str, Any], schema: Any, depth: int = 0) -> str:
+ if not isinstance(schema, dict) or depth > 4:
+ return "-"
+ if "$ref" in schema:
+ return ref_name(str(schema["$ref"]))
+ schema_type = schema.get("type")
+ if isinstance(schema_type, list):
+ schema_type = "/".join(str(item) for item in schema_type)
+ if schema_type == "array":
+ return f"Array<{schema_label(spec, schema.get('items'), depth + 1)}>"
+ if schema_type == "object" or "properties" in schema:
+ additional = schema.get("additionalProperties")
+ if isinstance(additional, dict):
+ return f"Map"
+ if additional is True:
+ return "Map"
+ properties = schema.get("properties")
+ if isinstance(properties, dict) and properties:
+ names = list(properties)
+ if len(names) > 8:
+ names = names[:8] + ["..."]
+ return "object{" + ", ".join(names) + "}"
+ return "object"
+ for keyword in ("oneOf", "anyOf", "allOf"):
+ items = schema.get(keyword)
+ if isinstance(items, list) and items:
+ joiner = " | " if keyword == "oneOf" else " & "
+ return "(" + joiner.join(schema_label(spec, item, depth + 1) for item in items) + ")"
+ if schema_type == "string" and schema.get("format") in ("binary", "byte"):
+ return "binary"
+ if schema_type:
+ return str(schema_type)
+ return "-"
+
+
+def pick_media(content: Any, preferred: tuple[str, ...]) -> tuple[str | None, Any]:
+ if not isinstance(content, dict) or not content:
+ return None, None
+ for media in preferred:
+ if media in content:
+ return media, content[media]
+ media = next(iter(content))
+ return media, content[media]
+
+
+def request_label(spec: dict[str, Any], operation: dict[str, Any]) -> str:
+ body = resolve(spec, operation.get("requestBody"))
+ if not isinstance(body, dict):
+ return "-"
+ media, entry = pick_media(body.get("content"), REQUEST_MEDIA)
+ if media is None:
+ return "-"
+ schema = entry.get("schema") if isinstance(entry, dict) else None
+ label = schema_label(spec, schema)
+ if label == "-":
+ return media
+ if media in ("application/json", "*/*"):
+ return label
+ return f"{label} ({media})"
+
+
+def response_label(spec: dict[str, Any], operation: dict[str, Any]) -> str:
+ responses = operation.get("responses")
+ if not isinstance(responses, dict) or not responses:
+ return "-"
+ response = None
+ for code in ("200", "201", "202", "204"):
+ if code in responses:
+ response = responses[code]
+ break
+ if response is None:
+ for code, candidate in responses.items():
+ if str(code).startswith("2"):
+ response = candidate
+ break
+ if response is None and "default" in responses:
+ response = responses["default"]
+ response = resolve(spec, response)
+ if not isinstance(response, dict):
+ return "-"
+ media, entry = pick_media(response.get("content"), RESPONSE_MEDIA)
+ if media is None:
+ return "-"
+ if media == "text/event-stream":
+ return "SSE"
+ schema = entry.get("schema") if isinstance(entry, dict) else None
+ label = schema_label(spec, schema)
+ if label == "-":
+ return media
+ if media in ("application/json", "*/*"):
+ return label
+ return f"{label} ({media})"
+
+
+def parameter_label(spec: dict[str, Any], path_item: dict[str, Any], operation: dict[str, Any]) -> str:
+ merged: dict[tuple[str, str], dict[str, Any]] = {}
+ for source in (path_item.get("parameters"), operation.get("parameters")):
+ if not isinstance(source, list):
+ continue
+ for raw in source:
+ parameter = resolve(spec, raw)
+ if not isinstance(parameter, dict):
+ continue
+ name = parameter.get("name")
+ location = parameter.get("in")
+ if name and location:
+ merged[(str(name), str(location))] = parameter
+ if not merged:
+ return "-"
+ parts = []
+ for (name, location), parameter in merged.items():
+ prefix = ""
+ if location in ("header", "cookie"):
+ prefix = f"{location}:"
+ suffix = "*" if parameter.get("required") else ""
+ parts.append(f"{prefix}{name}{suffix}")
+ return ", ".join(parts)
+
+
+def cell(value: Any) -> str:
+ text = "" if value is None else str(value)
+ text = re.sub(r"\s+", " ", text).strip()
+ text = text.replace("|", "\\|")
+ return text or "-"
+
+
+def module_key(path: str) -> str:
+ segments = [segment for segment in path.split("/") if segment]
+ if not segments:
+ return "root"
+ if segments[0] == "gao" and len(segments) > 1:
+ return f"gao-{segments[1]}"
+ return segments[0]
+
+
+def module_prefix(key: str) -> str:
+ if key == "root":
+ return "/"
+ if key.startswith("gao-"):
+ return f"/gao/{key[4:]}/"
+ return f"/{key}/"
+
+
+def module_sort(key: str) -> tuple[int, str]:
+ if key.startswith("gao-"):
+ return 0, key
+ order = {"system": 1, "user": 2, "app": 3}
+ return order.get(key, 4), key
+
+
+def collect_operations(spec: dict[str, Any]) -> list[dict[str, Any]]:
+ paths = spec.get("paths")
+ if not isinstance(paths, dict):
+ return []
+ operations = []
+ for path, path_item in paths.items():
+ if not isinstance(path_item, dict):
+ continue
+ path_item = resolve(spec, path_item)
+ if not isinstance(path_item, dict):
+ continue
+ for method in HTTP_METHODS:
+ operation = path_item.get(method)
+ if not isinstance(operation, dict):
+ continue
+ operation = resolve(spec, operation)
+ if not isinstance(operation, dict):
+ continue
+ summary = operation.get("summary") or operation.get("operationId") or ""
+ if operation.get("summary") is None and isinstance(summary, str):
+ summary = re.sub(r"_\d+$", "", summary)
+ if operation.get("deprecated"):
+ summary = f"[已废弃] {summary}"
+ public = operation["security"] == [] if "security" in operation else not spec.get("security")
+ if public:
+ summary = f"[公开] {summary}"
+ operations.append({
+ "methods": [method.upper()],
+ "path": path,
+ "summary": summary,
+ "parameters": parameter_label(spec, path_item, operation),
+ "request": request_label(spec, operation),
+ "response": response_label(spec, operation),
+ "tag": ", ".join(operation.get("tags") or []),
+ "module": module_key(path),
+ "order": (path, HTTP_METHODS.index(method)),
+ })
+ # 同一个处理器的多个 HTTP 方法(如 @RequestMapping 未限定 method)合并为一行。
+ merged: dict[tuple[Any, ...], dict[str, Any]] = {}
+ for operation in operations:
+ key = (
+ operation["path"],
+ operation["summary"],
+ operation["parameters"],
+ operation["request"],
+ operation["response"],
+ operation["tag"],
+ operation["module"],
+ )
+ if key in merged:
+ merged[key]["methods"].append(operation["methods"][0])
+ else:
+ merged[key] = operation
+ return list(merged.values())
+
+
+def render(spec: dict[str, Any], source: str) -> str:
+ info = spec.get("info") if isinstance(spec.get("info"), dict) else {}
+ title = info.get("title") or "OpenAPI"
+ version = info.get("version") or "-"
+ openapi_version = spec.get("openapi") or "-"
+ paths = spec.get("paths") if isinstance(spec.get("paths"), dict) else {}
+ operations = collect_operations(spec)
+ groups: dict[str, list[dict[str, Any]]] = {}
+ for operation in operations:
+ groups.setdefault(operation["module"], []).append(operation)
+ for items in groups.values():
+ items.sort(key=lambda item: item["order"])
+
+ lines = [
+ f"# {title} 接口索引",
+ "",
+ "> 本文件由 `scripts/openapi-index.py` 从 OpenAPI 快照生成,请勿手工编辑。",
+ f"> 数据来源:`{source}`。完整字段定义以 OpenAPI 原文为准。",
+ "",
+ f"- 服务版本:`{version}`",
+ f"- OpenAPI 版本:`{openapi_version}`",
+ f"- 路径数:{len(paths)}",
+ f"- 接口数:{len(operations)}(同一路径的同一处理器会合并多个 HTTP 方法)",
+ f"- 模块数:{len(groups)}",
+ "",
+ "## 使用说明",
+ "",
+ "- 先按模块定位接口,再读取 `docs/openapi.local.yaml` 中对应的 `path` 或 `components/schemas`,不要整文件加载。",
+ "- 参数列中 `*` 表示必填;`header:`、`cookie:` 为参数位置前缀,其余为 path/query 参数。",
+ "- 摘要前的 `[公开]` 表示 OpenAPI 中显式标记为无需登录;未标记的接口默认使用 `Token` 鉴权。",
+ "- 方法列出现多个 HTTP 方法,表示 Controller 使用了未限定 method 的 `@RequestMapping`。",
+ "- 请求体和响应列展示顶层 schema 名称;`binary` 表示二进制响应,`SSE` 表示 `text/event-stream`。",
+ "- 普通 JSON 接口的响应仍由 `TimiResponse` 包装,鉴权、错误码、分页等约定见 `docs/api-integration.md`。",
+ "",
+ "## 模块导航",
+ "",
+ "| 模块 | 接口数 | 路径前缀 |",
+ "| --- | ---: | --- |",
+ ]
+ for key in sorted(groups, key=module_sort):
+ lines.append(f"| [`{cell(key)}`](#module-{key}) | {len(groups[key])} | `{module_prefix(key)}` |")
+
+ for key in sorted(groups, key=module_sort):
+ lines.extend([
+ "",
+ f'',
+ f"## {key}",
+ "",
+ f"共 {len(groups[key])} 个接口,路径前缀 `{module_prefix(key)}`。",
+ "",
+ "| 方法 | 路径 | 摘要 | 参数 | 请求体 | 响应 | Tag |",
+ "| --- | --- | --- | --- | --- | --- | --- |",
+ ])
+ for operation in groups[key]:
+ lines.append(
+ "| {method} | `{path}` | {summary} | {parameters} | {request} | {response} | {tag} |".format(
+ method="/".join(operation["methods"]),
+ path=cell(operation["path"]),
+ summary=cell(operation["summary"]),
+ parameters=cell(operation["parameters"]),
+ request=cell(operation["request"]),
+ response=cell(operation["response"]),
+ tag=cell(operation["tag"]),
+ )
+ )
+ lines.append("")
+ return "\n".join(lines)
+
+
+def main() -> int:
+ parser = argparse.ArgumentParser(description="从 OpenAPI 文档生成 AI Agent 接口索引")
+ parser.add_argument("input", type=Path, help="OpenAPI JSON/YAML 文件")
+ parser.add_argument("output", type=Path, help="输出的 Markdown 文件")
+ parser.add_argument(
+ "--source-label",
+ default="docs/openapi.local.yaml",
+ help="索引中显示的数据来源(默认 docs/openapi.local.yaml)",
+ )
+ args = parser.parse_args()
+
+ spec = load_spec(args.input)
+ args.output.parent.mkdir(parents=True, exist_ok=True)
+ args.output.write_text(render(spec, args.source_label), encoding="utf-8", newline="\n")
+ print(f"OpenAPI index written to {args.output}")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/src/main/java/com/imyeyu/api/modules/common/controller/SettingController.java b/src/main/java/com/imyeyu/api/modules/common/controller/SettingController.java
index f1b16e8..881fad4 100644
--- a/src/main/java/com/imyeyu/api/modules/common/controller/SettingController.java
+++ b/src/main/java/com/imyeyu/api/modules/common/controller/SettingController.java
@@ -10,6 +10,10 @@ import com.imyeyu.spring.annotation.RequestRateLimit;
import com.imyeyu.spring.bean.Page;
import com.imyeyu.spring.bean.PageResult;
import com.imyeyu.spring.util.ResponseView;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.security.SecurityRequirements;
+import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
@@ -21,12 +25,11 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
-/**
- *
- *
- * @author 夜雨
- * @since 2026-04-23 16:31
- */
+/// 系统配置接口
+///
+/// @author 夜雨
+/// @since 2026-04-23 16:31
+@Tag(name = "系统-配置", description = "系统配置公开查询与管理接口")
@Slf4j
@RestController
@RequiredArgsConstructor
@@ -43,12 +46,17 @@ public class SettingController {
* @param code 配置代码列表,可为空
* @return 公开配置映射
*/
+ @Operation(summary = "查询公开配置映射", description = "按业务类型查询公开配置,返回以配置代码为键的映射;无需登录。")
+ @SecurityRequirements
@JsonView(ResponseView.Public.class)
@RequestRateLimit
@RequestMapping("/map")
public Map map(
+ @Parameter(description = "业务类型", required = true)
@RequestParam String bizType,
+ @Parameter(description = "业务 ID,系统级配置省略")
@RequestParam(required = false) String bizId,
+ @Parameter(description = "配置代码列表,省略时返回全部公开配置")
@RequestParam(required = false) List code
) {
return service.mapPublic(bizType, bizId, code);
@@ -60,6 +68,7 @@ public class SettingController {
* @param page 分页查询
* @return 配置列表
*/
+ @Operation(summary = "查询配置列表", description = "分页查询配置,需要 SETTING:READ 权限。")
@JsonView(ResponseView.Admin.class)
@RequestRateLimit
@RequireCorePermission(CorePermissionCode.SETTING_READ)
@@ -74,11 +83,14 @@ public class SettingController {
* @param id 配置 ID
* @return 配置详情
*/
+ @Operation(summary = "查询配置详情", description = "按配置 ID 查询配置,需要 SETTING:READ 权限。")
@JsonView(ResponseView.Admin.class)
@RequestRateLimit
@RequireCorePermission(CorePermissionCode.SETTING_READ)
@PostMapping("/detail")
- public Setting detail(@RequestBody String id) {
+ public Setting detail(
+ @io.swagger.v3.oas.annotations.parameters.RequestBody(description = "配置 ID", required = true)
+ @RequestBody String id) {
return service.get(id);
}
@@ -88,6 +100,7 @@ public class SettingController {
* @param setting 配置
* @return 配置
*/
+ @Operation(summary = "创建配置", description = "创建配置,需要 SETTING:CREATE 权限。")
@AOPLog
@JsonView(ResponseView.Admin.class)
@RequireCorePermission(CorePermissionCode.SETTING_CREATE)
@@ -103,6 +116,7 @@ public class SettingController {
*
* @param setting 配置
*/
+ @Operation(summary = "更新配置", description = "更新配置,需要 SETTING:UPDATE 权限。")
@AOPLog
@RequestRateLimit
@RequireCorePermission(CorePermissionCode.SETTING_UPDATE)
@@ -116,11 +130,14 @@ public class SettingController {
*
* @param id 配置 ID
*/
+ @Operation(summary = "删除配置", description = "按配置 ID 删除配置,需要 SETTING:DELETE 权限。")
@AOPLog
@RequestRateLimit
@RequireCorePermission(CorePermissionCode.SETTING_DELETE)
@PostMapping("/delete")
- public void delete(@RequestBody String id) {
+ public void delete(
+ @io.swagger.v3.oas.annotations.parameters.RequestBody(description = "配置 ID", required = true)
+ @RequestBody String id) {
service.delete(id);
}
}
diff --git a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoCustomerController.java b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoCustomerController.java
index ce16d13..fa22d75 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoCustomerController.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoCustomerController.java
@@ -67,6 +67,21 @@ public class GaoCustomerController {
@PostMapping("/detail")
@JsonView(ResponseView.Public.class)
public GaoCustomer detail(@RequestParam String id) {
+ return detailInternal(id);
+ }
+
+ @AOPLog
+ @RequestRateLimit
+ @RequireGaoPermission(GaoPermissionCode.CUSTOMER_READ)
+ @PostMapping("/detail/list")
+ @JsonView(ResponseView.Public.class)
+ public List detailList(@RequestBody List idList) {
+ TimiException.requiredTrue(idList != null && !idList.isEmpty(), "not found customer.idList");
+ TimiException.requiredTrue(idList.size() <= 50, "customer.idList too large");
+ return idList.stream().distinct().map(this::detailInternal).toList();
+ }
+
+ private GaoCustomer detailInternal(String id) {
GaoCustomer customer = service.get(id);
TimiException.required(customer, "not found customer");
storeScopeService.checkStoreId(customer.getStoreId());
diff --git a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoFundRecordController.java b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoFundRecordController.java
index f7659e7..07667a3 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoFundRecordController.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoFundRecordController.java
@@ -71,6 +71,26 @@ public class GaoFundRecordController {
return result;
}
+ @AOPLog
+ @RequestRateLimit
+ @RequireGaoPermission(GaoPermissionCode.FUND_RECORD_READ)
+ @PostMapping("/detail/list")
+ public List detailList(@RequestBody List idList) {
+ TimiException.requiredTrue(idList != null && !idList.isEmpty(), "not found fundRecord.idList");
+ TimiException.requiredTrue(idList.size() <= 50, "fundRecord.idList too large");
+ return idList.stream().distinct().map(this::detail).toList();
+ }
+
+ @AOPLog
+ @RequestRateLimit
+ @RequireGaoPermission(GaoPermissionCode.FUND_RECEIVE_CREATE)
+ @PostMapping("/my-receive/detail/list")
+ public List detailMyReceiveList(@RequestBody List idList) {
+ TimiException.requiredTrue(idList != null && !idList.isEmpty(), "not found fundRecord.idList");
+ TimiException.requiredTrue(idList.size() <= 50, "fundRecord.idList too large");
+ return idList.stream().distinct().map(this::detailMyReceive).toList();
+ }
+
@AOPLog
@RequestRateLimit
@RequireGaoPermission(GaoPermissionCode.FUND_RECEIVE_CREATE)
diff --git a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoOrderFulfillmentController.java b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoOrderFulfillmentController.java
index ac83c86..bcd9f1c 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoOrderFulfillmentController.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoOrderFulfillmentController.java
@@ -83,6 +83,16 @@ public class GaoOrderFulfillmentController {
return result;
}
+ @AOPLog
+ @RequestRateLimit
+ @RequireGaoPermission(GaoPermissionCode.ORDER_FULFILLMENT_READ)
+ @PostMapping("/detail/list")
+ public List detailList(@RequestBody List idList) {
+ TimiException.requiredTrue(idList != null && !idList.isEmpty(), "not found fulfillment.idList");
+ TimiException.requiredTrue(idList.size() <= 50, "fulfillment.idList too large");
+ return idList.stream().distinct().map(this::detail).toList();
+ }
+
@AOPLog
@RequestRateLimit
@PostMapping("/create")
diff --git a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoPackageConfigController.java b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoPackageConfigController.java
index 4e9e440..4ed0fbf 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoPackageConfigController.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoPackageConfigController.java
@@ -75,6 +75,16 @@ public class GaoPackageConfigController {
return config;
}
+ @AOPLog
+ @RequestRateLimit
+ @RequireGaoPermission(GaoPermissionCode.PACKAGE_CONFIG_READ)
+ @PostMapping("/detail/list")
+ public List detailList(@RequestBody List idList) {
+ TimiException.requiredTrue(idList != null && !idList.isEmpty(), "not found packageConfig.idList");
+ TimiException.requiredTrue(idList.size() <= 50, "packageConfig.idList too large");
+ return idList.stream().distinct().map(this::detail).toList();
+ }
+
private void fillTransient(List configList, boolean includeProductDetail) {
if (configList == null || configList.isEmpty()) {
return;
diff --git a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoPointRedeemSkuController.java b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoPointRedeemSkuController.java
index 5429a60..38b50ad 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoPointRedeemSkuController.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoPointRedeemSkuController.java
@@ -18,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
+import java.util.List;
+
/// GAO 积分兑换 SKU 配置接口
///
/// @author Codex
@@ -52,6 +54,18 @@ public class GaoPointRedeemSkuController {
return service.detail(storeScopeService.resolveStoreId(storeId), id);
}
+ @AOPLog
+ @RequestRateLimit
+ @RequireGaoPermission(GaoPermissionCode.POINT_REDEEM_SKU_MANAGE)
+ @PostMapping("/detail/list")
+ public List detailList(@RequestBody List idList,
+ @RequestParam(required = false) String storeId) {
+ TimiException.requiredTrue(idList != null && !idList.isEmpty(), "not found redeemSku.idList");
+ TimiException.requiredTrue(idList.size() <= 50, "redeemSku.idList too large");
+ String resolvedStoreId = storeScopeService.resolveStoreId(storeId);
+ return idList.stream().distinct().map(id -> service.detail(resolvedStoreId, id)).toList();
+ }
+
@AOPLog
@RequestRateLimit
@RequireGaoPermission(GaoPermissionCode.POINT_REDEEM_SKU_MANAGE)
diff --git a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoProductController.java b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoProductController.java
index 7529f65..d7d33a1 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoProductController.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoProductController.java
@@ -114,6 +114,16 @@ public class GaoProductController {
return result;
}
+ @AOPLog
+ @RequestRateLimit
+ @RequireGaoPermission(GaoPermissionCode.PRODUCT_READ)
+ @PostMapping("/detail/list")
+ public List detailList(@RequestBody List idList) {
+ TimiException.requiredTrue(idList != null && !idList.isEmpty(), "not found product.idList");
+ TimiException.requiredTrue(idList.size() <= 50, "product.idList too large");
+ return idList.stream().distinct().map(this::detail).toList();
+ }
+
@AOPLog
@RequestRateLimit
@RequireGaoPermission(GaoPermissionCode.PRODUCT_CREATE)
@@ -171,6 +181,16 @@ public class GaoProductController {
return result;
}
+ @AOPLog
+ @RequestRateLimit
+ @RequireGaoPermission(GaoPermissionCode.PRODUCT_READ)
+ @PostMapping("/sku/detail/list")
+ public List skuDetailList(@RequestBody List idList) {
+ TimiException.requiredTrue(idList != null && !idList.isEmpty(), "not found sku.idList");
+ TimiException.requiredTrue(idList.size() <= 50, "sku.idList too large");
+ return idList.stream().distinct().map(this::skuDetail).toList();
+ }
+
/// 批量查询履约所需的 SKU 信息
///
/// @param idList SKU ID 列表
diff --git a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoRecycleConfigController.java b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoRecycleConfigController.java
index 21384db..5fe8ec4 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoRecycleConfigController.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoRecycleConfigController.java
@@ -7,6 +7,7 @@ import com.imyeyu.api.modules.gao.entity.GaoRecycleExchangeRule;
import com.imyeyu.api.modules.gao.service.GaoRecycleConfigService;
import com.imyeyu.api.modules.gao.vo.recycle.GaoRecycleItemRequest;
import com.imyeyu.api.modules.gao.vo.recycle.GaoRecycleExchangeRuleRequest;
+import com.imyeyu.java.bean.timi.TimiException;
import com.imyeyu.spring.annotation.AOPLog;
import com.imyeyu.spring.annotation.RequestRateLimit;
import lombok.RequiredArgsConstructor;
@@ -17,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.imyeyu.spring.bean.PageResult;
+import java.util.List;
+
/// 回收物和兑换规则接口
@RestController
@RequiredArgsConstructor
@@ -73,6 +76,17 @@ public class GaoRecycleConfigController {
return service.ruleDetail(storeId, id);
}
+ @AOPLog
+ @RequestRateLimit
+ @RequireGaoPermission(GaoPermissionCode.RECYCLE_EXCHANGE_CONFIG_MANAGE)
+ @PostMapping("/rule/detail/list")
+ public List ruleDetailList(@RequestBody List idList,
+ @RequestParam(required = false) String storeId) {
+ TimiException.requiredTrue(idList != null && !idList.isEmpty(), "not found recycleRule.idList");
+ TimiException.requiredTrue(idList.size() <= 50, "recycleRule.idList too large");
+ return idList.stream().distinct().map(id -> service.ruleDetail(storeId, id)).toList();
+ }
+
@AOPLog
@RequestRateLimit
@RequireGaoPermission(GaoPermissionCode.RECYCLE_EXCHANGE_CONFIG_MANAGE)
diff --git a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoSalesOrderController.java b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoSalesOrderController.java
index c903064..37f5703 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoSalesOrderController.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoSalesOrderController.java
@@ -37,6 +37,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
+import java.util.List;
+
/// GAO 销售订单和资金接口
///
/// @author Codex
@@ -100,6 +102,16 @@ public class GaoSalesOrderController {
return result;
}
+ @AOPLog
+ @RequestRateLimit
+ @RequireGaoPermission(GaoPermissionCode.SALES_ORDER_READ)
+ @PostMapping("/detail/list")
+ public List detailList(@RequestBody List idList) {
+ TimiException.requiredTrue(idList != null && !idList.isEmpty(), "not found salesOrder.idList");
+ TimiException.requiredTrue(idList.size() <= 50, "salesOrder.idList too large");
+ return idList.stream().distinct().map(this::detail).toList();
+ }
+
@AOPLog
@RequestRateLimit
@RequireGaoPermission(GaoPermissionCode.SALES_ORDER_CREATE)
diff --git a/src/main/java/com/imyeyu/api/modules/system/bean/ServerFile.java b/src/main/java/com/imyeyu/api/modules/system/bean/ServerFile.java
index 6430aab..ec83bd9 100644
--- a/src/main/java/com/imyeyu/api/modules/system/bean/ServerFile.java
+++ b/src/main/java/com/imyeyu/api/modules/system/bean/ServerFile.java
@@ -1,5 +1,6 @@
package com.imyeyu.api.modules.system.bean;
+import com.imyeyu.api.modules.system.util.FilePreview;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.tika.Tika;
@@ -103,12 +104,7 @@ public class ServerFile implements Serializable {
this.mimeType = TIKA.detect(this.name);
this.category = FileCategory.of(this.mimeType, this.extension, false);
this.etag = String.format("\"%x-%x\"", this.size, this.modifiedAt);
- this.canPreview = switch (this.mimeType) {
- case "image/png", "image/jpeg", "image/gif", "image/webp", "image/bmp",
- "video/mp4", "video/quicktime", "video/webm",
- "application/pdf", "text/plain" -> true;
- default -> false;
- };
+ this.canPreview = FilePreview.supports(this.mimeType);
} else {
this.size = 0L;
this.modifiedAt = absolute.toFile().lastModified();
diff --git a/src/main/java/com/imyeyu/api/modules/system/controller/FileContentController.java b/src/main/java/com/imyeyu/api/modules/system/controller/FileContentController.java
index 08f15f4..3a7925f 100644
--- a/src/main/java/com/imyeyu/api/modules/system/controller/FileContentController.java
+++ b/src/main/java/com/imyeyu/api/modules/system/controller/FileContentController.java
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
@@ -55,15 +56,18 @@ public class FileContentController {
FileBinaryResponder.serve(resp, () -> contentService.serve(req, resp, path, true));
}
- @Operation(summary = "预览文件", description = "图片和视频返回 PNG 缩略图,PDF 与文本返回原始内容。")
- @RequestRateLimit
+ @Operation(summary = "预览文件", description = "图片和视频返回缩略图,其他类型不支持。")
@RequireCorePermission(CorePermissionCode.FILE_READ)
@IgnoreGlobalReturn
@GetMapping("/preview/{*path}")
public void preview(
HttpServletRequest req, HttpServletResponse resp,
@Parameter(description = "文件虚拟路径,以 / 开头", required = true)
- @PathVariable("path") String path) {
- FileBinaryResponder.serve(resp, () -> contentService.preview(req, resp, path));
+ @PathVariable("path") String path,
+ @Parameter(description = "缩略图最大边长(像素),范围 32-512,默认 256", example = "256")
+ @RequestParam(value = "size", required = false, defaultValue = "256") int size,
+ @Parameter(description = "缓存版本号,建议传文件列表返回的 etag;传入后使用长期强缓存")
+ @RequestParam(value = "v", required = false) String version) {
+ FileBinaryResponder.serve(resp, () -> contentService.preview(req, resp, path, size, version));
}
}
diff --git a/src/main/java/com/imyeyu/api/modules/system/service/FileContentService.java b/src/main/java/com/imyeyu/api/modules/system/service/FileContentService.java
index 3edcdb4..1f7578a 100644
--- a/src/main/java/com/imyeyu/api/modules/system/service/FileContentService.java
+++ b/src/main/java/com/imyeyu/api/modules/system/service/FileContentService.java
@@ -1,5 +1,6 @@
package com.imyeyu.api.modules.system.service;
+import com.imyeyu.api.modules.system.util.FilePreview;
import com.imyeyu.api.modules.system.util.ResourceHandler;
import com.imyeyu.java.bean.timi.TimiCode;
import com.imyeyu.java.bean.timi.TimiException;
@@ -28,6 +29,8 @@ public class FileContentService {
"text/html", "application/xhtml+xml", "image/svg+xml",
"application/javascript", "text/javascript", "application/x-javascript"
);
+ private static final String PREVIEW_CACHE_CONTROL = "private, max-age=86400";
+ private static final String PREVIEW_IMMUTABLE_CACHE_CONTROL = "private, max-age=31536000, immutable";
private final FileStorageService storage;
private final ThumbnailService thumbnailService;
@@ -56,7 +59,7 @@ public class FileContentService {
resp.setHeader("ETag", info.etag());
resp.setDateHeader("Last-Modified", info.modifiedAt());
resp.setHeader("Cache-Control", "private, max-age=0, must-revalidate");
- if (notModified(req, info)) {
+ if (notModified(req, info.etag())) {
resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
return;
}
@@ -80,50 +83,48 @@ public class FileContentService {
}
}
- /// 输出预览图。图片/视频走缩略图缓存,PDF/文本直接内联。
- public void preview(HttpServletRequest req, HttpServletResponse resp, String virtualPath) {
+ /// 输出预览图。仅图片和视频支持,按请求尺寸生成缩略图。
+ ///
+ /// @param size 缩略图最大边长
+ /// @param version 缓存版本号,建议传文件列表返回的 etag;传入后使用长期强缓存
+ public void preview(HttpServletRequest req, HttpServletResponse resp, String virtualPath, int size, String version) {
+ ThumbnailService.requireValidSize(size);
ContentInfo info = info(virtualPath);
- if (info.attachment()) {
+ if (info.attachment() || !FilePreview.supports(info.mimeType())) {
throw new TimiException(TimiCode.ARG_BAD, "该文件类型不支持在线预览");
}
- resp.setHeader("ETag", info.etag());
+ String etag = previewEtag(info, size);
+ resp.setHeader("ETag", etag);
resp.setDateHeader("Last-Modified", info.modifiedAt());
- if (notModified(req, info)) {
+ resp.setHeader("Cache-Control", version == null || version.isBlank()
+ ? PREVIEW_CACHE_CONTROL : PREVIEW_IMMUTABLE_CACHE_CONTROL);
+ if (notModified(req, etag)) {
resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
return;
}
- if (info.mimeType().startsWith("image/") || info.mimeType().startsWith("video/")) {
- Path thumbnail = thumbnailService.thumbnail(info.path(), info.mimeType());
- try {
- resp.setContentType("image/png");
- resp.setHeader("X-Content-Type-Options", "nosniff");
- resp.setHeader("Cache-Control", "private, max-age=86400");
- resp.setContentLengthLong(Files.size(thumbnail));
- Files.copy(thumbnail, resp.getOutputStream());
- } catch (IOException e) {
- throw new TimiException(TimiCode.ERROR, "生成预览失败");
- }
- return;
- }
- if ("application/pdf".equals(info.mimeType()) || "text/plain".equals(info.mimeType())) {
- resp.setContentType(info.mimeType());
+ Path thumbnail = thumbnailService.thumbnail(info.path(), info.mimeType(), size);
+ try {
+ resp.setContentType(contentType(thumbnail));
resp.setHeader("X-Content-Type-Options", "nosniff");
- resp.setHeader("Content-Disposition", "inline; filename*=UTF-8''" +
- java.net.URLEncoder.encode(info.path().getFileName().toString(), java.nio.charset.StandardCharsets.UTF_8).replace("+", "%20"));
- resp.setContentLengthLong(info.size());
- try {
- Files.copy(info.path(), resp.getOutputStream());
- } catch (IOException e) {
- throw new TimiException(TimiCode.ERROR, "读取文件失败");
- }
- return;
+ resp.setContentLengthLong(Files.size(thumbnail));
+ Files.copy(thumbnail, resp.getOutputStream());
+ } catch (IOException e) {
+ throw new TimiException(TimiCode.ERROR, "生成预览失败");
}
- throw new TimiException(TimiCode.ARG_BAD, "该文件类型不支持预览");
}
- private boolean notModified(HttpServletRequest req, ContentInfo info) {
+ private String previewEtag(ContentInfo info, int size) {
+ return "\"%s-%s-%d\"".formatted(
+ ThumbnailService.ALGORITHM_VERSION, info.etag().replace("\"", ""), size);
+ }
+
+ private String contentType(Path thumbnail) {
+ return thumbnail.getFileName().toString().endsWith(".png") ? "image/png" : "image/jpeg";
+ }
+
+ private boolean notModified(HttpServletRequest req, String etag) {
String ifNoneMatch = req.getHeader("If-None-Match");
- return ifNoneMatch != null && ifNoneMatch.contains(info.etag());
+ return ifNoneMatch != null && ifNoneMatch.contains(etag);
}
public record ContentInfo(Path path, String mimeType, long size, long modifiedAt, String etag,
diff --git a/src/main/java/com/imyeyu/api/modules/system/service/ThumbnailService.java b/src/main/java/com/imyeyu/api/modules/system/service/ThumbnailService.java
index c03e38b..dd74ae2 100644
--- a/src/main/java/com/imyeyu/api/modules/system/service/ThumbnailService.java
+++ b/src/main/java/com/imyeyu/api/modules/system/service/ThumbnailService.java
@@ -16,44 +16,60 @@ import java.awt.image.BufferedImage;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Iterator;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutionException;
/// 缩略图缓存服务。
@Service
@RequiredArgsConstructor
public class ThumbnailService {
- private static final int SIZE = 256;
+ /// 缩略图算法版本,算法或输出格式变化时递增,使旧缓存和浏览器缓存失效
+ public static final String ALGORITHM_VERSION = "v2";
+
+ /// 允许的缩略图最小边长
+ public static final int MIN_SIZE = 32;
+
+ /// 允许的缩略图最大边长
+ public static final int MAX_SIZE = 512;
+
+ private static final double JPEG_QUALITY = 0.82;
private static final long MAX_PIXELS = 50_000_000L;
private final FileStorageService storage;
- public Path thumbnail(Path source, String mimeType) {
+ /// 同一缩略图的并发生成任务,避免平铺列表同时请求同一文件时重复解码
+ private final ConcurrentMap> generating = new ConcurrentHashMap<>();
+
+ /// 校验缩略图尺寸是否在允许范围内。
+ public static void requireValidSize(int size) {
+ if (size < MIN_SIZE || MAX_SIZE < size) {
+ throw new TimiException(TimiCode.ARG_BAD, "缩略图尺寸必须在 " + MIN_SIZE + "-" + MAX_SIZE + " 之间");
+ }
+ }
+
+ /// 获取缩略图缓存路径,缓存不存在时生成。
+ ///
+ /// @param source 源文件
+ /// @param mimeType 源文件 MIME 类型
+ /// @param size 缩略图最大边长
+ /// @return 缩略图文件
+ public Path thumbnail(Path source, String mimeType, int size) {
+ requireValidSize(size);
+ String format = outputFormat(mimeType);
try {
- long modifiedAt = Files.getLastModifiedTime(source).toMillis();
- long size = Files.size(source);
- String key = sha256(source.toAbsolutePath() + "|" + modifiedAt + "|" + size + "|" + SIZE);
- Path target = storage.thumbnailPath().resolve(key + ".png");
+ String key = cacheKey(source, size, format);
+ Path target = storage.thumbnailPath().resolve(key + "." + format);
if (Files.isRegularFile(target)) {
return target;
}
- Files.createDirectories(target.getParent());
- if (mimeType.startsWith("video/")) {
- Picture picture;
- try {
- picture = FrameGrab.getFrameAtSec(source.toFile(), 0);
- } catch (Exception e) {
- picture = FrameGrab.getFrameAtSec(source.toFile(), 1);
- }
- BufferedImage image = AWTUtil.toBufferedImage(picture);
- ImageIO.write(image, "png", target.toFile());
- } else {
- validatePixelCount(source);
- Thumbnails.of(source.toFile()).size(SIZE, SIZE).outputFormat("png").toFile(target.toFile());
- }
- return target;
+ return generateOnce(key, target, source, mimeType, size, format);
} catch (TimiException e) {
throw e;
} catch (Exception e) {
@@ -61,8 +77,137 @@ public class ThumbnailService {
}
}
- /// 在完整解码前检查图片像素数,避免超大图片耗尽内存。
- private void validatePixelCount(Path source) throws IOException {
+ private Path generateOnce(String key, Path target, Path source, String mimeType, int size, String format) {
+ CompletableFuture future = new CompletableFuture<>();
+ CompletableFuture running = generating.putIfAbsent(key, future);
+ if (running != null) {
+ return await(running);
+ }
+ try {
+ if (Files.isRegularFile(target)) {
+ future.complete(target);
+ return target;
+ }
+ Path result = generate(source, mimeType, size, format, target);
+ future.complete(result);
+ return result;
+ } catch (Throwable e) {
+ future.completeExceptionally(e);
+ if (e instanceof TimiException te) {
+ throw te;
+ }
+ if (e instanceof RuntimeException re) {
+ throw re;
+ }
+ if (e instanceof Error error) {
+ throw error;
+ }
+ throw new TimiException(TimiCode.ERROR, "生成缩略图失败");
+ } finally {
+ generating.remove(key, future);
+ }
+ }
+
+ private Path await(CompletableFuture future) {
+ try {
+ return future.get();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new TimiException(TimiCode.ERROR, "生成缩略图失败");
+ } catch (ExecutionException e) {
+ Throwable cause = e.getCause();
+ if (cause instanceof TimiException te) {
+ throw te;
+ }
+ if (cause instanceof RuntimeException re) {
+ throw re;
+ }
+ if (cause instanceof Error error) {
+ throw error;
+ }
+ throw new TimiException(TimiCode.ERROR, "生成缩略图失败");
+ }
+ }
+
+ private Path generate(Path source, String mimeType, int size, String format, Path target) throws IOException {
+ Files.createDirectories(target.getParent());
+ Path temp = Files.createTempFile(target.getParent(), "thumb-", "." + format);
+ try {
+ if (mimeType.startsWith("video/")) {
+ BufferedImage frame = videoFrame(source);
+ write(Thumbnails.of(frame), boundedSize(frame.getWidth(), frame.getHeight(), size), format, temp);
+ } else {
+ int[] dimensions = imageDimensions(source);
+ write(Thumbnails.of(source.toFile()).useExifOrientation(true),
+ boundedSize(dimensions[0], dimensions[1], size), format, temp);
+ }
+ move(temp, target);
+ return target;
+ } catch (TimiException e) {
+ throw e;
+ } catch (IOException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IOException("生成缩略图失败", e);
+ } finally {
+ Files.deleteIfExists(temp);
+ }
+ }
+
+ /// 小图不放大,避免生成模糊且更大的缩略图。
+ private int boundedSize(int width, int height, int size) {
+ return Math.min(size, Math.max(width, height));
+ }
+
+ private void write(Thumbnails.Builder> builder, int size, String format, Path target) throws IOException {
+ builder.size(size, size).outputFormat(format);
+ if ("jpg".equals(format)) {
+ builder.outputQuality(JPEG_QUALITY);
+ }
+ builder.toFile(target.toFile());
+ }
+
+ private BufferedImage videoFrame(Path source) throws Exception {
+ Picture picture;
+ try {
+ picture = FrameGrab.getFrameAtSec(source.toFile(), 0);
+ } catch (Exception e) {
+ picture = FrameGrab.getFrameAtSec(source.toFile(), 1);
+ }
+ if (picture == null) {
+ throw new IOException("无法读取视频帧");
+ }
+ return AWTUtil.toBufferedImage(picture);
+ }
+
+ /// 使用原子移动避免其他请求读到写了一半的缩略图。
+ private void move(Path temp, Path target) throws IOException {
+ try {
+ Files.move(temp, target, StandardCopyOption.ATOMIC_MOVE);
+ } catch (IOException e) {
+ if (Files.isRegularFile(target)) {
+ return;
+ }
+ Files.move(temp, target, StandardCopyOption.REPLACE_EXISTING);
+ }
+ }
+
+ /// PNG/GIF 源图输出 PNG,其余输出 JPEG(视频帧也使用 JPEG)。
+ private String outputFormat(String mimeType) {
+ return switch (mimeType) {
+ case "image/png", "image/gif" -> "png";
+ default -> "jpg";
+ };
+ }
+
+ private String cacheKey(Path source, int size, String format) throws IOException {
+ long modifiedAt = Files.getLastModifiedTime(source).toMillis();
+ long fileSize = Files.size(source);
+ return sha256(ALGORITHM_VERSION + "|" + source.toAbsolutePath() + "|" + modifiedAt + "|" + fileSize + "|" + size + "|" + format);
+ }
+
+ /// 在完整解码前检查图片像素数,避免超大图片耗尽内存,并返回原始尺寸。
+ private int[] imageDimensions(Path source) throws IOException {
try (ImageInputStream input = ImageIO.createImageInputStream(source.toFile())) {
if (input == null) {
throw new IOException("无法读取图片");
@@ -74,10 +219,12 @@ public class ThumbnailService {
ImageReader reader = readers.next();
try {
reader.setInput(input, true, true);
- long pixels = (long) reader.getWidth(0) * reader.getHeight(0);
- if (MAX_PIXELS < pixels) {
+ int width = reader.getWidth(0);
+ int height = reader.getHeight(0);
+ if (MAX_PIXELS < (long) width * height) {
throw new TimiException(TimiCode.ARG_BAD, "图片像素过大");
}
+ return new int[]{width, height};
} finally {
reader.dispose();
}
diff --git a/src/main/java/com/imyeyu/api/modules/system/util/FilePreview.java b/src/main/java/com/imyeyu/api/modules/system/util/FilePreview.java
new file mode 100644
index 0000000..0ab4d17
--- /dev/null
+++ b/src/main/java/com/imyeyu/api/modules/system/util/FilePreview.java
@@ -0,0 +1,25 @@
+package com.imyeyu.api.modules.system.util;
+
+import java.util.Set;
+
+/// 文件缩略图预览类型判定。
+///
+/// 只包含当前缩略图生成链路实际支持的图片和视频类型,避免列表把不可预览的文件标记为可预览。
+///
+/// @author 夜雨
+/// @since 2026-11-25
+public final class FilePreview {
+
+ private static final Set MIME_TYPES = Set.of(
+ "image/png", "image/jpeg", "image/gif", "image/bmp",
+ "video/mp4", "video/quicktime", "video/webm"
+ );
+
+ private FilePreview() {
+ }
+
+ /// 是否为支持缩略图预览的类型。
+ public static boolean supports(String mimeType) {
+ return MIME_TYPES.contains(mimeType);
+ }
+}
diff --git a/src/test/java/com/imyeyu/api/modules/system/service/FileContentServiceTest.java b/src/test/java/com/imyeyu/api/modules/system/service/FileContentServiceTest.java
index 25348b0..de48e30 100644
--- a/src/test/java/com/imyeyu/api/modules/system/service/FileContentServiceTest.java
+++ b/src/test/java/com/imyeyu/api/modules/system/service/FileContentServiceTest.java
@@ -8,6 +8,8 @@ import org.junit.jupiter.api.io.TempDir;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
@@ -19,8 +21,11 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
/// 文件内容服务测试。
class FileContentServiceTest {
@@ -58,7 +63,36 @@ class FileContentServiceTest {
Files.writeString(temp.resolve("a.html"), "", StandardCharsets.UTF_8);
assertThrows(TimiException.class, () -> service.preview(new MockHttpServletRequest(),
- new MockHttpServletResponse(), "/a.html"));
+ new MockHttpServletResponse(), "/a.html", 256, null));
+ }
+
+ @Test
+ void rejectsPdfPreview() throws IOException {
+ Files.writeString(temp.resolve("a.pdf"), "%PDF-1.4", StandardCharsets.UTF_8);
+
+ assertThrows(TimiException.class, () -> service.preview(new MockHttpServletRequest(),
+ new MockHttpServletResponse(), "/a.pdf", 256, null));
+ }
+
+ @Test
+ void previewsImageWithRequestedSize() throws Exception {
+ Path source = temp.resolve("a.png");
+ ImageIO.write(new BufferedImage(8, 8, BufferedImage.TYPE_INT_RGB), "png", source.toFile());
+ Path thumbnail = temp.resolve("thumb.png");
+ Files.write(thumbnail, new byte[]{1, 2, 3});
+
+ ThumbnailService thumbnailService = mock(ThumbnailService.class);
+ when(thumbnailService.thumbnail(any(), eq("image/png"), eq(128))).thenReturn(thumbnail);
+ FileContentService service = new FileContentService(FileTestSupport.storage(temp, Map.of()),
+ thumbnailService, resourceHandler);
+ MockHttpServletResponse resp = new MockHttpServletResponse();
+
+ service.preview(new MockHttpServletRequest(), resp, "/a.png", 128, "etag");
+
+ assertEquals("image/png", resp.getContentType());
+ assertEquals(3, resp.getContentAsByteArray().length);
+ assertTrue(resp.getHeader("ETag").contains("-128"));
+ assertTrue(resp.getHeader("Cache-Control").contains("immutable"));
}
@Test
diff --git a/src/test/java/com/imyeyu/api/modules/system/service/ThumbnailServiceTest.java b/src/test/java/com/imyeyu/api/modules/system/service/ThumbnailServiceTest.java
new file mode 100644
index 0000000..fb8d573
--- /dev/null
+++ b/src/test/java/com/imyeyu/api/modules/system/service/ThumbnailServiceTest.java
@@ -0,0 +1,97 @@
+package com.imyeyu.api.modules.system.service;
+
+import com.imyeyu.java.bean.timi.TimiException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/// 缩略图缓存服务测试。
+class ThumbnailServiceTest {
+
+ @TempDir
+ Path temp;
+
+ private ThumbnailService service;
+
+ @BeforeEach
+ void setUp() throws Exception {
+ service = new ThumbnailService(FileTestSupport.storage(temp, Map.of()));
+ }
+
+ @Test
+ void generatesPngForPngSource() throws Exception {
+ Path source = temp.resolve("a.png");
+ ImageIO.write(new BufferedImage(100, 50, BufferedImage.TYPE_INT_RGB), "png", source.toFile());
+
+ Path thumbnail = service.thumbnail(source, "image/png", 32);
+
+ assertTrue(Files.isRegularFile(thumbnail));
+ assertTrue(thumbnail.getFileName().toString().endsWith(".png"));
+ BufferedImage image = ImageIO.read(thumbnail.toFile());
+ assertEquals(32, image.getWidth());
+ assertEquals(16, image.getHeight());
+ }
+
+ @Test
+ void generatesJpegForJpegSource() throws Exception {
+ Path source = temp.resolve("a.jpg");
+ ImageIO.write(new BufferedImage(100, 50, BufferedImage.TYPE_INT_RGB), "jpg", source.toFile());
+
+ Path thumbnail = service.thumbnail(source, "image/jpeg", 64);
+
+ assertTrue(Files.isRegularFile(thumbnail));
+ assertTrue(thumbnail.getFileName().toString().endsWith(".jpg"));
+ BufferedImage image = ImageIO.read(thumbnail.toFile());
+ assertEquals(64, image.getWidth());
+ assertEquals(32, image.getHeight());
+ }
+
+ @Test
+ void reusesCachedThumbnail() throws Exception {
+ Path source = temp.resolve("a.png");
+ ImageIO.write(new BufferedImage(100, 50, BufferedImage.TYPE_INT_RGB), "png", source.toFile());
+
+ Path first = service.thumbnail(source, "image/png", 64);
+ Path second = service.thumbnail(source, "image/png", 64);
+
+ assertEquals(first, second);
+ }
+
+ @Test
+ void cachesEachSizeSeparately() throws Exception {
+ Path source = temp.resolve("a.png");
+ ImageIO.write(new BufferedImage(100, 50, BufferedImage.TYPE_INT_RGB), "png", source.toFile());
+
+ assertNotEquals(service.thumbnail(source, "image/png", 64),
+ service.thumbnail(source, "image/png", 128));
+ }
+
+ @Test
+ void doesNotUpscaleSmallImage() throws Exception {
+ Path source = temp.resolve("small.png");
+ ImageIO.write(new BufferedImage(20, 10, BufferedImage.TYPE_INT_RGB), "png", source.toFile());
+
+ Path thumbnail = service.thumbnail(source, "image/png", 256);
+
+ BufferedImage image = ImageIO.read(thumbnail.toFile());
+ assertEquals(20, image.getWidth());
+ assertEquals(10, image.getHeight());
+ }
+
+ @Test
+ void rejectsInvalidSize() {
+ assertThrows(TimiException.class, () -> service.thumbnail(temp.resolve("a.png"), "image/png", 8));
+ assertThrows(TimiException.class, () -> service.thumbnail(temp.resolve("a.png"), "image/png", 1024));
+ }
+}