| | |
| | | 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://maps.googleapis.com/maps/api" |
| | | let Google_Url_Road = "https://roads.googleapis.com/v1" |
| | | #else |
| | | let All_Url = "http://54.67.44.33:8040" |
| | | let Google_Url = "https://maps.googleapis.com/maps/api" |
| | | let Google_Url_Road = "https://roads.googleapis.com/v1" |
| | | #endif |
| | | |
| | | |
| | |
| | | .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) |
| | | return NetworkRequest.request(params: params, method: .get, progress: false) |
| | | } |
| | | |
| | | } |
| | |
| | | .append(key: "destination", value: destination.toFormat()) |
| | | .append(key: "waypoints", value: waypoints) |
| | | .append(key: "alternatives", value: false) //可供选择方案:会增加请求时间 |
| | | // .append(key: "optimize", value: true) |
| | | return NetworkRequest.requestMap(params: params.googleMapDone(), method: .get, progress: false) |
| | | } |
| | | |
| | | |
| | | /// When directions line was done , need call the method snap to the road. |
| | | /// - Parameter path: coordiante paths |
| | | class func snapToRoads(path:String)->Observable<BaseResponse<SnappedPointsModel>>{ |
| | | let params = ParamsAppender.build(url: Google_Url) |
| | | class func snapToRoads(path:String)->Observable<SnappedPointsModel>{ |
| | | let params = ParamsAppender.build(url: Google_Url_Road) |
| | | .interface(url: "/snapToRoads/") |
| | | .append(key: "path", value: path) |
| | | .append(key: "interpolate", value: true) |
| | | params.params.removeValue(forKey: "appid") |
| | | params.params.removeValue(forKey: "language") |
| | | return NetworkRequest.request(params: params.googleMapDone(), method: .post, progress: false) |
| | | .append(key: "interpolate", value: "true") |
| | | return NetworkRequest.requestMap(params: params.googleMapDone(has: false), method: .get, progress: false) |
| | | } |
| | | } |