// // StatisticsService.swift // JiaPeiManage // // Created by Ning.ge on 2023/6/26. // import RxSwift import RxCocoa import SwiftyJSON protocol StatisticsServiceType { //查询每日报名数 func everyDayStuCountRequest(city: String, schoolId: Int, startDate: String, endDate: String) -> Single //查询每月报名数 func everyMonthStuCount(city: String, schoolId: Int, startMonth: String, endMonth: String) -> Single //查询每年报名数 func everyYearStuCount(city: String, schoolId: Int, startYear: String, endYear: String) -> Single //查询驾校ID 报名数 func statisticsStuCount(city: String, schoolId: Int) -> Single } final class StatisticsService: StatisticsServiceType { private let networking : StatisticsNetworking init(networking: StatisticsNetworking) { self.networking = networking } //查询每日报名数 func everyDayStuCountRequest(city: String, schoolId: Int, startDate: String, endDate: String) -> RxSwift.Single { let api = StatisticsAPI.everyDayStuCount(city: city, schoolId: schoolId, startDate: startDate, endDate: endDate) return networking.request(api).map(StuCountDataModel.self, isModel: true) } //查询每月报名数 func everyMonthStuCount(city: String, schoolId: Int, startMonth: String, endMonth: String) -> RxSwift.Single { let api = StatisticsAPI.everyMonthStuCount(city: city, schoolId: schoolId, startMonth: startMonth, endMonth: endMonth) return networking.request(api).map(StuCountDataModel.self, isModel: true) } //查询每年报名数 func everyYearStuCount(city: String, schoolId: Int, startYear: String, endYear: String) -> RxSwift.Single { let api = StatisticsAPI.everyYearStuCount(city: city, schoolId: schoolId, startYear: startYear, endYear: endYear) return networking.request(api).map(StuCountDataModel.self, isModel: true) } //查询驾校ID 报名数 func statisticsStuCount(city: String, schoolId: Int) -> RxSwift.Single { let api = StatisticsAPI.statisticsStuCount(city: city, schoolId: schoolId) return networking.request(api).map(StuTotalCountDataModel.self) } }