适配上传中订单并完善机巢操作与订阅兜底
支持订单状态 25 和持续拍摄、交付确认;安全指令点击后直接提交;鉴权超时保留 HTTP 兜底并退避换票重连。补充对应隔离回归测试。
This commit is contained in:
@@ -185,6 +185,13 @@ struct DroneDockHomeToday: Decodable, Equatable, Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
/// 整单履约阶段,与订单飞行任务、航线任务的数字状态分别解析。
|
||||
enum DroneDockOrderStatus: Int, Sendable {
|
||||
case executing = 20
|
||||
case uploading = 25
|
||||
case completed = 30
|
||||
}
|
||||
|
||||
/// 张工类型 25 订单摘要;操作入口取后端 can_* 权限,进入准备页仍需校验设备条件。
|
||||
struct DroneDockHomeOrder: Decodable, Equatable, Sendable {
|
||||
/// 订单号同时作为 Diffable 稳定身份,不虚构接口未提供的整数 ID。
|
||||
@@ -207,7 +214,7 @@ struct DroneDockHomeOrder: Decodable, Equatable, Sendable {
|
||||
let shotRemain: Int?
|
||||
/// 拍摄列表状态 pending、processing、completed;未知值保留。
|
||||
let shootStatus: String?
|
||||
/// 订单支付和交付状态,与飞行任务状态分开。
|
||||
/// 整单履约状态:20 执行中、25 素材上传中、30 已完成;保留未知原值。
|
||||
let orderStatus: Int?
|
||||
/// 整单原素材汇总状态。
|
||||
let materialStatus: Int?
|
||||
@@ -295,8 +302,20 @@ struct DroneDockHomeOrder: Decodable, Equatable, Sendable {
|
||||
/// 缺失项目名称时保留未知。
|
||||
var packageTitle: String { DroneDockHomeMetric.usableText(packageName) ?? "套餐信息待确认" }
|
||||
|
||||
/// 仅映射文档定义的拍摄列表状态,不根据次数推导完成。
|
||||
/// 已知整单状态;未知值仍保留在原始 orderStatus 中。
|
||||
var knownOrderStatus: DroneDockOrderStatus? { orderStatus.flatMap(DroneDockOrderStatus.init(rawValue:)) }
|
||||
|
||||
/// 执行和素材上传均为未完成订单,具体操作仍由各自后端许可决定。
|
||||
var isActiveOrderStatus: Bool { knownOrderStatus == .executing || knownOrderStatus == .uploading }
|
||||
|
||||
/// 上传、完成优先使用整单状态;执行中的未拍订单保留明确的待拍摄提示。
|
||||
var statusTitle: String {
|
||||
switch knownOrderStatus {
|
||||
case .uploading: return "素材上传中"
|
||||
case .completed: return "已完成"
|
||||
case .executing: return shootStatus == "pending" ? "待拍摄" : "执行中"
|
||||
case nil: break
|
||||
}
|
||||
switch shootStatus {
|
||||
case "pending": return "待拍摄"
|
||||
case "processing": return "进行中"
|
||||
@@ -305,6 +324,22 @@ struct DroneDockHomeOrder: Decodable, Equatable, Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
/// 卡片使用统一语义色,不把素材上传中显示为任务失败或订单已完成。
|
||||
var statusTone: DroneDockStatusTone {
|
||||
switch knownOrderStatus {
|
||||
case .uploading: return .blue
|
||||
case .completed: return .green
|
||||
case .executing: return shootStatus == "pending" ? .blue : .orange
|
||||
case nil:
|
||||
switch shootStatus {
|
||||
case "pending": return .blue
|
||||
case "processing": return .orange
|
||||
case "completed": return .green
|
||||
default: return .gray
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 逐项展示真实计数和未知占位,不把任务数当作已使用次数。
|
||||
var progressTitle: String {
|
||||
let used = shotUsed.map(String.init) ?? "—"
|
||||
@@ -326,7 +361,7 @@ struct DroneDockHomeOrder: Decodable, Equatable, Sendable {
|
||||
var canDeliverFilm: Bool {
|
||||
switch orderStatus {
|
||||
case 30: true
|
||||
case 20, nil: canUploadFilm == true
|
||||
case 20, 25, nil: canUploadFilm == true
|
||||
default: false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user