feat: 添加 POST /api/repair/ship 端点#370
Merged
huan-yp merged 13 commits intoOpenWSGR:mainfrom Mar 14, 2026
Merged
Conversation
添加 /api/repair/ship 路由,接受 ship_name 参数,调用已有的 repair_ship_by_name() 函数将指定舰船送入浴室修理。 返回修理时间(秒),浴场已满时返回错误。 此端点供 AutoWSGR-GUI 前端的泡澡修理系统使用。
for more information, see https://pre-commit.ci
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
添加
POST /api/repair/ship路由端点,支持按舰船名称将指定舰船送入浴室修理。变更
文件:
autowsgr/server/routes/ops.pyRepairShipRequest请求模型(ship_name: str)POST /api/repair/ship路由,调用已有的repair_ship_by_name()函数请求/响应示例
成功响应:
{"success": true, "data": {"ship_name": "胡德", "repair_seconds": 3600}, "message": "胡德 已送入泡澡修理 (3600s)"}浴场已满:
{"success": false, "error": "浴场已满,无法修理 胡德"}背景
此端点供 AutoWSGR-GUI 前端的泡澡修理系统使用。GUI 实现了编队预设轮换机制:任务执行前检查编队舰船血量,低于阈值时调用此端点将舰船送入浴室,同时切换到另一套编队预设继续战斗。
底层函数
repair_ship_by_name()已存在于autowsgr/ops/repair.py中,本 PR 仅添加 HTTP 路由暴露该功能。