feat: 完善 Release 接口日志与未报备提示
This commit is contained in:
@@ -8,18 +8,22 @@ struct DroneDockPreparationFailure: Equatable, Sendable {
|
||||
let title: String
|
||||
/// 原因及下一步操作,不包含接口 JSON。
|
||||
let message: String
|
||||
/// 后端文字明确指出报备问题时,额外弹出提醒。
|
||||
/// 后端已确认的召唤业务码或明确文字指出报备问题时,额外弹出提醒。
|
||||
let requiresFiling: Bool
|
||||
|
||||
/// 未获得专用错误码前,仅匹配明确报备/备案失败的文字,其他原因保持后端原意。
|
||||
init(message: String, stage: Stage, outcomeUnknown: Bool) {
|
||||
requiresFiling = !outcomeUnknown && Self.isFilingFailure(message)
|
||||
/// shoot 的 41901 表示当日起飞未报备;其他接口或错误码仍仅匹配明确报备失败的文字。
|
||||
init(message: String, stage: Stage, outcomeUnknown: Bool, code: Int? = nil) {
|
||||
let requiresFilingScreenshot = stage == .summon && code == 41901
|
||||
requiresFiling = !outcomeUnknown && (requiresFilingScreenshot || Self.isFilingFailure(message))
|
||||
if outcomeUnknown {
|
||||
title = stage == .creation ? "任务创建结果待核对" : "召唤结果待核对"
|
||||
self.message = message
|
||||
} else if requiresFiling {
|
||||
title = "请先完成飞行报备"
|
||||
self.message = message + "\n请联系相关负责人核实并完成飞行报备,确认生效后再重试。"
|
||||
let guidance = requiresFilingScreenshot
|
||||
? "请联系相关负责人完成该无人机今日的起飞报备并提交报备截图,确认生效后再重试。"
|
||||
: "请联系相关负责人核实并完成飞行报备,确认生效后再重试。"
|
||||
self.message = message + "\n" + guidance
|
||||
} else if stage == .summon && Self.requiresTaskReview(message) {
|
||||
title = "任务已结束"
|
||||
self.message = "当前任务已结束,无法直接召唤。请先查看拍摄任务状态;如需重新召唤,在任务页确认后操作。"
|
||||
@@ -35,7 +39,7 @@ struct DroneDockPreparationFailure: Equatable, Sendable {
|
||||
}
|
||||
|
||||
private static func isFilingFailure(_ message: String) -> Bool {
|
||||
["未报备", "未完成报备", "报备未", "报备失败", "报备过期", "报备已过期",
|
||||
["未报备", "未完成报备", "未完成起飞报备", "请先提交报备截图", "报备未", "报备失败", "报备过期", "报备已过期",
|
||||
"报备失效", "报备已失效", "无有效报备", "没有报备", "无报备", "请先报备", "需要报备",
|
||||
"未备案", "未完成备案", "备案未", "备案失败", "备案已过期", "请先备案"]
|
||||
.contains(where: message.contains)
|
||||
|
||||
Reference in New Issue
Block a user