// // UserConfigResponse.swift // QuickLocation // // Created by 八条 on 2026/5/26. // import Foundation import ObjectMapper private let kUserStatusTransformInt64 = TransformOf(fromJSON: { value in switch value { case let value as Int64: return value case let value as Int: return Int64(value) case let value as Double: return Int64(value) case let value as String: return Int64(value) default: return nil } }, toJSON: { value in value }) class UserConfigResponse: BaseModelProtocol { var code: String? var message: String? var model: UserConfigModel? required init?(map: Map) { } func mapping(map: Map) { code <- map["code"] message <- map["message"] model <- map["data"] } } class UserLoginRespons: BaseModelProtocol { var code: String? var message: String? var model: UserConfigModel? required init?(map: Map) { } func mapping(map: Map) { code <- map["code"] message <- map["message"] model <- map["data"] } } struct UserStatusResponse: BaseModelProtocol { var code: String? var message: String? var model: UserStatusModel? init?(map: Map) {} mutating func mapping(map: Map) { code <- (map["code"], kIntTransformStr) message <- map["message"] model <- map["data"] } } struct UserStatusModel: Mappable { var status: Int = 0 var mood: Int = 0 var bubbleTime: Int64 = 0 init?(map: Map) {} mutating func mapping(map: Map) { status <- (map["status"], kStrTransformInt) mood <- (map["mood"], kStrTransformInt) bubbleTime <- (map["bubble_time"], kUserStatusTransformInt64) } var bubbleEndDate: Date? { guard bubbleTime > 0 else { return nil } let seconds = bubbleTime >= 100_000_000_000 ? TimeInterval(bubbleTime) / 1000 : TimeInterval(bubbleTime) return Date(timeIntervalSince1970: seconds) } }