1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- //
- // ElogCoachAPI.swift
- // JiaPeiManage
- //
- // Created by Ning.ge on 2023/8/30.
- //
- import Moya
- import SwiftyUserDefaults
- enum ElogCoachAPI {
- //根据学员id获取电子教学日志
- case elogTmsStudentTeachLogById(city:String ,id:Int ,pageNum:Int ,pageSize:Int)
- //根据学员id和classId获取电子教学日志照片
- case elogTmsStudentPhotoById(city:String ,classId:String ,id:Int ,pageNum:Int ,pageSize:Int)
- }
- extension ElogCoachAPI: TargetType {
-
- var baseURL: URL {
- switch self {
- case .elogTmsStudentTeachLogById,.elogTmsStudentPhotoById:
- return URL(string: HttpRequest.api.path)!
- }
- }
-
- var path: String {
- // city:String ,coachId:String ,field:String ,pageNum:Int ,pageSize:Int ,schoolId:Int
- switch self {
- case .elogTmsStudentTeachLogById(_,_,_,_):
- return "/jsjp-admin/open-api/tms/coachInfo/getTmsStudentTeachLogById"
- case .elogTmsStudentPhotoById(_,_,_,_,_):
- return "/jsjp-admin/open-api/tms/coachInfo/getTmsStudentPhotoById"
-
- }
-
- }
-
- var method: Moya.Method {
- switch self {
- case .elogTmsStudentTeachLogById,.elogTmsStudentPhotoById:
- return .get
- default:
- return .get
- }
- }
-
- var sampleData: Data {
- return Data()
- }
-
- var task: Moya.Task {
- switch self {
- case .elogTmsStudentTeachLogById(_,_,_,_),.elogTmsStudentPhotoById(_,_,_,_,_):
- 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 .elogTmsStudentTeachLogById(city, id, pageNum, pageSize):
- return ["city": city,
- "id": id,
- "pageNum": pageNum,
- "pageSize": pageSize]
- case let .elogTmsStudentPhotoById(city, classId, id, pageNum, pageSize):
- return ["city": city,
- "classId": classId,
- "id": id,
- "pageNum": pageNum,
- "pageSize": pageSize]
- default:
- return nil
- }
- }
-
-
- }
|