feat(drone-dock): 接通任务召唤与状态页并固定拍摄布局

接入 plane-status、tasks/create、shoot 与 shooting,保持同一任务 ID 串接、重复提交保护和只读单次刷新。拍摄任务页固定顶部参数与底部安全控制,中间状态区域适配小屏且不滚动;同步接口记录、脱敏响应及相关测试。
This commit is contained in:
2026-10-29 17:06:49 +08:00
parent 4d763ef5d1
commit 1173207756
47 changed files with 6723 additions and 81 deletions
@@ -0,0 +1,29 @@
import Foundation
/// 朱工拍摄任务信息只读服务,读取张工已创建的任务,不发送飞行控制。
protocol DroneDockShootingServing: Sendable {
/// 按已有任务 ID 获取拍摄页信息;读取失败后可对同一 ID 再次读取。
@MainActor
func shooting(taskID: Int, liveBattery: Bool) async throws -> DroneDockShootingResponse
}
/// shooting GET 接口适配,鉴权及业务码由统一客户端处理。
@MainActor
final class DroneDockShootingAPI: DroneDockShootingServing {
private let client: APIClient
/// 注入共享网络客户端,便于验证请求只包含已创建任务的查询参数。
init(client: APIClient) { self.client = client }
/// 仅发送一次无请求体的 GET,不创建任务、不召唤、不调用 start-shoot。
func shooting(taskID: Int, liveBattery: Bool = true) async throws -> DroneDockShootingResponse {
try Task.checkCancellation()
guard taskID > 0 else { throw APIError.networkFailed("缺少有效拍摄任务 ID,请先创建任务") }
return try await client.send(APIRequest(
method: .get,
path: "/api/app/airport/shooting",
queryItems: [URLQueryItem(name: "id", value: String(taskID)),
URLQueryItem(name: "live_battery", value: liveBattery ? "1" : "0")]
))
}
}