jsdw_ios/QuickLocation/Section/Schedule/ScheduleModel.swift

154 lines
3.8 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// ScheduleModel.swift
// QuickLocation
//
// Created by on 2026/6/23.
//
import ObjectMapper
import RxDataSources
//
struct ScheduleListResponse: BaseModelProtocol, ListModelType {
var pagination: PaginationModel?
//
var pageIndex = 1
//
var pageSize = 20
//
var count = 0
//
var page_count = -99
//
var code: String?
//
var message: String?
//
var list: [ScheduleModel] = []
init() {}
init?(map: Map) {
}
mutating func mapping(map: Map) {
code <- map["code"]
message <- map["msg"]
list <- map["data"]
count = list.count
pagination = PaginationModel(pageIndex: pageIndex,
pageSize: pageSize,
totalNum: count,
totalPage: page_count)
}
}
struct ScheduleModel: Mappable, Equatable {
var uuid: String = UUID().uuidString
/// id
var id: String = ""
/// id
var creator_id: String = ""
///
var nick_name: String = ""
var head_pic: String = ""
///
var userIcon: UIImage {
UIImage(named: "UserIcon/\(head_pic)") ?? UIImage()
}
///
var timestamp: Int64 = 0
///
var is_follow: Bool = false
///
var is_own: Bool = false
///
var points: [SchedulePointModel] = []
///
// var group_name: String = ""
/// key
// var group_key: String = ""
init?(map: Map) {
}
mutating func mapping(map: Map) {
id <- map["id"]
creator_id <- map["creator_id"]
nick_name <- map["nick_name"]
head_pic <- map["head_pic"]
timestamp <- map["timestamp"]
is_follow <- map["is_follow"]
is_own <- map["is_own"]
points <- map["points"]
// group_name <- map["groups.group_name"]
// group_key <- map["groups.group_key"]
}
}
extension ScheduleModel: IdentifiableType {
public typealias Identity = String
public var identity: String {
return id
}
}
///
struct SchedulePointModel: Mappable, Equatable {
/// id
var id: String = ""
/// 0 1 2
var type: Int = 0
///
var expected_timestamp: Int64 = 0
///
var longitude: Double?
///
var latitude: Double?
///
var province: String = ""
var district: String = ""
var country: String = ""
var street: String = ""
var city: String = ""
var formatted_address: String = ""
///
var remark: String = ""
///
var eventText: String = ""
///
var sequence: Int = 0
init?(map: Map) {
}
mutating func mapping(map: Map) {
id <- map["id"]
type <- map["type"]
expected_timestamp <- map["expected_timestamp"]
longitude <- map["location.longitude"]
latitude <- map["location.latitude"]
remark <- map["remark"]
eventText <- map["events.text"]
province <- map["address.province"]
district <- map["address.district"]
country <- map["address.country"]
street <- map["address.street"]
city <- map["address.city"]
formatted_address <- map["address.formatted_address"]
sequence <- map["sequence"]
}
}
extension SchedulePointModel: IdentifiableType {
public typealias Identity = String
public var identity: String {
return id
}
}