younger_times
2023-08-15 2ebbafa4b4a2994ae979fed38e1266d9efd5657e
BrokerDriver/Network/Services.swift
@@ -11,12 +11,12 @@
import Alamofire
#if DEBUG
let All_Url = "http://192.168.110.22:8040"
let All_Url = "http://54.67.44.33:8040"
//let All_Url = "http://54.67.44.33:8040"
let Google_Url = "https://roads.googleapis.com/v1"
let Google_Url = "https://maps.googleapis.com/maps/api"
#else
let All_Url = "http://54.67.44.33:8040"
let Google_Url = "https://roads.googleapis.com/v1"
let Google_Url = "https://maps.googleapis.com/maps/api"
#endif
@@ -171,6 +171,16 @@
        return NetworkRequest.request(params: params, method: .post, progress: true)
    }
      /// 上传定位
   class func uploadLocation(coordinate:CLLocationCoordinate2D)->Observable<BaseResponse<SimpleModel>>{
      let params = ParamsAppender.build(url: All_Url)
         .interface(url: "/api/order/updateLonLat")
         .append(key: "driverId", value:UserViewModel.getUserInfo()!.id)
         .append(key: "lat", value: "\(coordinate.latitude)")
         .append(key: "lon", value: "\(coordinate.longitude)")
      return NetworkRequest.request(params: params, method: .post, progress: true)
   }
}
class GoogleServices:NSObject{
@@ -192,13 +202,14 @@
        }
    }
    class func directionsLine(origin:DirectionType,destination:DirectionType)->Observable<BaseResponse<GoogleRoteModel>>{
   class func directionsLine(origin:DirectionType,destination:DirectionType,waypoints:String)->Observable<GoogleRoteModel>{
        let params = ParamsAppender.build(url: Google_Url)
            .interface(url: "/directions/json")
            .append(key: "origin", value: origin.toFormat())
            .append(key: "destination", value: destination.toFormat())
         .append(key: "waypoints", value: waypoints)
            .append(key: "alternatives", value: false) //可供选择方案:会增加请求时间
        return NetworkRequest.request(params: params.googleMapDone(), method: .post, progress: false)
        return NetworkRequest.requestMap(params: params.googleMapDone(), method: .get, progress: false)
    }