feat: 接入拍摄任务实时订阅并完善日志与封面
This commit is contained in:
@@ -2,6 +2,20 @@ import Foundation
|
||||
|
||||
/// 朱工 shooting 的只读快照;完整 data 用于展示,不表示已召唤或已开始拍摄。
|
||||
struct DroneDockShootingResponse: Decodable, Equatable, Sendable {
|
||||
/// HTTP/推送共用的顶层任务身份。
|
||||
let orderFlightTaskID: Int?
|
||||
/// 同一执行批次下递增的完整快照版本。
|
||||
let stateVersion: Int64?
|
||||
/// 当前航线执行批次,先比较批次再比较版本,防止重召唤后的旧数据回退。
|
||||
let executionBatch: Int64?
|
||||
/// 第一版只接收 full 完整推送。
|
||||
let snapshotKind: String?
|
||||
/// 后端状态写入时间,不能作为设备读数采集时间。
|
||||
let stateUpdatedAt: String?
|
||||
/// 设备读数采集时间,用于显示来源和核对缓存。
|
||||
let metricsUpdatedAt: String?
|
||||
/// 设备缓存过期时保留数值,但标为非实时读数。
|
||||
let metricsStale: Bool?
|
||||
/// 后端若明确提供订单号则保留,不由请求上下文伪造响应身份。
|
||||
let orderNumber: String?
|
||||
/// 实测返回的订单飞行任务身份;存在时必须与请求上下文核对。
|
||||
@@ -31,6 +45,9 @@ struct DroneDockShootingResponse: Decodable, Equatable, Sendable {
|
||||
|
||||
/// 只映射已知展示字段,不假设响应中的任务 ID 位置。
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case orderFlightTaskID = "order_flight_task_id", stateVersion = "state_version"
|
||||
case executionBatch = "execution_batch", snapshotKind = "snapshot_kind"
|
||||
case stateUpdatedAt = "state_updated_at", metricsUpdatedAt = "metrics_updated_at", metricsStale = "metrics_stale"
|
||||
case orderNumber = "order_number", orderFlightTask = "order_flight_task", task
|
||||
case scenic, scenicSpot = "scenic_spot", airLine = "air_line"
|
||||
case header, currentPlane = "current_plane", executeGate = "execute_gate", ui
|
||||
@@ -40,6 +57,13 @@ struct DroneDockShootingResponse: Decodable, Equatable, Sendable {
|
||||
/// 可选字段缺失或为 null 时保持未知;不把缺失执行门禁推断为允许。
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
orderFlightTaskID = try container.decodeIfPresent(Int.self, forKey: .orderFlightTaskID)
|
||||
stateVersion = try container.decodeIfPresent(Int64.self, forKey: .stateVersion)
|
||||
executionBatch = try container.decodeIfPresent(Int64.self, forKey: .executionBatch)
|
||||
snapshotKind = try container.decodeIfPresent(String.self, forKey: .snapshotKind)
|
||||
stateUpdatedAt = try container.decodeIfPresent(String.self, forKey: .stateUpdatedAt)
|
||||
metricsUpdatedAt = try container.decodeIfPresent(String.self, forKey: .metricsUpdatedAt)
|
||||
metricsStale = try container.decodeIfPresent(Bool.self, forKey: .metricsStale)
|
||||
orderNumber = try container.decodeIfPresent(String.self, forKey: .orderNumber)
|
||||
orderFlightTask = try container.decodeIfPresent(DroneDockShootingTaskIdentity.self, forKey: .orderFlightTask)
|
||||
task = try container.decodeIfPresent(DroneDockShootingTaskIdentity.self, forKey: .task)
|
||||
|
||||
Reference in New Issue
Block a user