接入举报摄影师正式接口
This commit is contained in:
@ -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 [:]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user