接入举报摄影师正式接口

This commit is contained in:
2026-07-08 16:38:15 +08:00
parent 4a78a0c21a
commit 290a01e699
12 changed files with 2586 additions and 218 deletions

View File

@ -167,7 +167,7 @@ struct PhotographerProfileInfoResponse: Decodable, Equatable {
holidayEndTime = try container.decodeLossyString(forKey: .holidayEndTime)
businessRange = try container.decodeLossyIntArray(forKey: .businessRange)
acceptOrderStatus = try container.decodeLossyInt(forKey: .acceptOrderStatus) ?? 0
schedule = try container.decodeIfPresent([String: [PhotographerSchedule]].self, forKey: .schedule) ?? [:]
schedule = try container.decodeScheduleMap(forKey: .schedule)
virtualPhone = try container.decodeLossyString(forKey: .virtualPhone)
}
}
@ -612,4 +612,15 @@ private extension KeyedDecodingContainer {
}
return []
}
func decodeScheduleMap(forKey key: Key) throws -> [String: [PhotographerSchedule]] {
if let values = try? decodeIfPresent([String: [PhotographerSchedule]].self, forKey: key) {
return values
}
if let values = try? decodeIfPresent([PhotographerSchedule].self, forKey: key) {
return Dictionary(grouping: values) { $0.scheduleDate }
.filter { !$0.key.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty }
}
return [:]
}
}