CoachService.swift 974 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // CoachService.swift
  3. // JiaPeiManage
  4. //
  5. // Created by Ning.ge on 2023/6/13.
  6. //
  7. import RxSwift
  8. import RxCocoa
  9. import SwiftyJSON
  10. protocol CoachServiceType {
  11. //获取教练信息
  12. func coachInfoRequest(id:String ,city:String) -> Single<UserInfo>
  13. //获取教练二维码
  14. func coachQrInfoRequest(id:String ,city:String) -> Single<UserInfo>
  15. }
  16. final class CoachService: CoachServiceType {
  17. private let networking : CoachNetworking
  18. init(networking: CoachNetworking) {
  19. self.networking = networking
  20. }
  21. func coachInfoRequest(id: String, city: String) -> RxSwift.Single<UserInfo> {
  22. let api = CoachAPI.coachInfo(id: id, city: city)
  23. return networking.request(api).map(UserInfo.self)
  24. }
  25. func coachQrInfoRequest(id: String, city: String) -> RxSwift.Single<UserInfo> {
  26. let api = CoachAPI.coachQrInfo(id: id, city: city)
  27. return networking.request(api).map(UserInfo.self)
  28. }
  29. }