123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- //
- // StatisticsAPI.swift
- // JiaPeiManage
- //
- // Created by Ning.ge on 2023/6/26.
- //
- import Moya
- import SwiftyUserDefaults
- enum StatisticsAPI {
-
- //查询每日报名数
- case everyDayStuCount(city:String,schoolId:Int,startDate:String, endDate:String)
- //查询每月报名数
- case everyMonthStuCount(city:String,schoolId:Int,startMonth:String, endMonth:String)
- //查询每年报名数
- case everyYearStuCount(city:String,schoolId:Int,startYear:String, endYear:String)
- //查询驾校ID 报名数
- case statisticsStuCount(city:String,schoolId:Int)
-
- }
- extension StatisticsAPI: TargetType {
- var baseURL: URL {
- switch self {
- case .everyDayStuCount,.everyMonthStuCount,.everyYearStuCount,.statisticsStuCount:
- return URL(string: HttpRequest.api.path)!
- }
- }
-
- var path: String {
- switch self {
- case .everyDayStuCount(_,_,_,_):
- return "/jsjp-admin/open-api/tms/coachInfo/getEveryDayStuCountBySchoolId"
- case .everyMonthStuCount(_,_,_,_):
- return "/jsjp-admin/open-api/tms/coachInfo/getEveryMonthStuCountBySchoolId"
- case .everyYearStuCount(_,_,_,_):
- return "/jsjp-admin/open-api/tms/coachInfo/getEveryYearStuCountBySchoolId"
- case .statisticsStuCount(_,_):
- return "/jsjp-admin/open-api/tms/coachInfo/getStatisticsStuCountBySchoolId"
- }
- }
- var method: Moya.Method {
- // switch self {
- // case .loginUser,.dictUser:
- // return .get
- // case .updateUser:
- // return .put
- // default:
- // return .get
- // }
- return .get
- }
-
- var sampleData: Data {
- return Data()
- }
-
- var task: Moya.Task {
- // switch self {
- // case .loginUser(_,_,_):
- // if let parameters = parameters {
- // return .requestParameters(parameters: parameters, encoding: URLEncoding.default)
- // }
- // return .requestPlain
- // case .updateUser(_,_,_,_):
- // if let parameters = parameters {
- // return .requestParameters(parameters: parameters, encoding: URLEncoding.default)
- // }
- // return .requestPlain
- // case .dictUser(_):
- // return .requestPlain
- // }
- if let parameters = parameters {
- return .requestParameters(parameters: parameters, encoding: URLEncoding.default)
- }
- return .requestPlain
- }
-
- var headers: [String: String]? {
- return ["Content-Type":"application/json"]
- }
-
- var parameters: [String : Any]? {
-
- switch self {
- case let .everyDayStuCount(city, schoolId,startDate,endDate):
- return ["city": city,
- "schoolId": schoolId,
- "startDate":startDate,
- "endDate":endDate,]
- case let .everyMonthStuCount(city, schoolId,startDate,endDate):
- return ["city": city,
- "schoolId": schoolId,
- "startDate":startDate,
- "endDate":endDate,]
- case let .everyYearStuCount(city, schoolId,startDate,endDate):
- return ["city": city,
- "schoolId": schoolId,
- "startDate":startDate,
- "endDate":endDate,]
- case let .statisticsStuCount(city, schoolId):
- return ["city": city,
- "schoolId": schoolId]
- default:
- return nil
- }
- }
-
- var urlParameters: [String: Any]? {
- var parameters = parameters
- // if let extendsParameters = ["":""] {
- // parameters = parameters?.merging(extendsParameters) { $1 } //组合
- // }
- return parameters
- }
-
-
- }
|