37 lines
1.1 KiB
Swift
37 lines
1.1 KiB
Swift
//
|
|
// DrivingService.swift
|
|
// QuickLocation
|
|
//
|
|
// Created by 八条 on 2026/6/30.
|
|
//
|
|
|
|
import RxSwift
|
|
import Moya
|
|
|
|
struct DrivingService {
|
|
static let disposeBag = DisposeBag()
|
|
|
|
/// 驾驶事件
|
|
/// - Parameters:
|
|
/// - user_id: 用户id
|
|
/// - start_time: 开始时间戳
|
|
/// - end_time: 结束时间戳
|
|
static func drivingEvents(user_id: String, start_time: String, end_time: String) -> Observable<DrivingStatsResponse> {
|
|
let api = DrivingAPI.drivingEvents(user_id: user_id, start_time: start_time, end_time: end_time).multiTarget
|
|
return APIProvider.request(token: api)
|
|
.map(DrivingStatsResponse.self)
|
|
.asObservable()
|
|
}
|
|
|
|
/// 轨迹回放
|
|
/// - Parameters:
|
|
/// - user_id: 用户id
|
|
/// - date: 开始时间戳
|
|
static func playback(user_id: String, date: String) -> Observable<ScheduleRecordListResponse> {
|
|
let api = DrivingAPI.playback(user_id: user_id, date: date).multiTarget
|
|
return APIProvider.request(token: api)
|
|
.map(ScheduleRecordListResponse.self)
|
|
.asObservable()
|
|
}
|
|
}
|