feat: 接入拍摄任务实时订阅并完善日志与封面
This commit is contained in:
@@ -38,6 +38,24 @@ struct DroneDockPurchasedSpot: Decodable, Equatable, Sendable {
|
||||
/// 购买范围内的航线,按服务端顺序展示。
|
||||
let airLines: [DroneDockPurchasedAirLine]
|
||||
|
||||
/// 卡片优先使用点位封面,缺失或无效时取本点位已购航线的第一张有效样片封面。
|
||||
var displayCoverURL: URL? {
|
||||
if let url = Self.imageURL(coverURL) { return url }
|
||||
for route in airLines {
|
||||
for sample in route.samples {
|
||||
if let url = Self.imageURL(sample.coverURL) { return url }
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
private static func imageURL(_ value: String?) -> URL? {
|
||||
guard let text = DroneDockHomeMetric.usableText(value), let url = URL(string: text),
|
||||
let scheme = url.scheme?.lowercased(), ["https", "http"].contains(scheme),
|
||||
let host = url.host, !host.isEmpty else { return nil }
|
||||
return url
|
||||
}
|
||||
|
||||
/// 张工购买点位字段,不接收 workbench 的 name 作为替代。
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case id = "scenic_spot_id", name = "scenic_spot_name", available
|
||||
|
||||
Reference in New Issue
Block a user