| | |
| | | object HttpManager { |
| | | private const val PAGE_SIZE = 20 |
| | | private val service: ApiService = RRetrofit.instance().create(ApiService::class.java) |
| | | private val googleService: GoogleApiService = RRetrofit.instance(false).create(GoogleApiService::class.java) |
| | | |
| | | /** |
| | | * 发起请求方法 |
| | | */ |
| | | private fun request() = service |
| | | |
| | | /** |
| | | * 发起请求方法 |
| | | */ |
| | | private fun googleRequest() = googleService |
| | | |
| | | private fun getAppId() = SPUtils.instance().getString(Const.User.APP_ID) |
| | | /** |
| | |
| | | //1=简体中文,2=英语,3=法语 |
| | | val language = LanguageUtil.getLanguage() |
| | | val lan = if (language == Const.Language.CHINESE) "zh-CN" else language |
| | | return request().geoCode(IGoApplication.tripId,"${lat},${lon}",lan) |
| | | return googleRequest().geoCode(IGoApplication.tripId,"${lat},${lon}",lan) |
| | | } |
| | | |
| | | /** |
| | |
| | | //1=简体中文,2=英语,3=法语 |
| | | val language = LanguageUtil.getLanguage() |
| | | val lan = if (language == Const.Language.CHINESE) "zh-CN" else language |
| | | return request().textsearch(IGoApplication.tripId,key,"${lat},${lon}",lan) |
| | | return googleRequest().textsearch(IGoApplication.tripId,key,"${lat},${lon}",lan) |
| | | // return request().textsearch(key,5.586363,-0.187788,IGoApplication.chooseCityName,lan) //阿克拉 5.586363,-0.187788 |
| | | } |
| | | |
| | |
| | | //1=简体中文,2=英语,3=法语 |
| | | val language = LanguageUtil.getLanguage() |
| | | val lan = if (language == Const.Language.CHINESE) "zh-CN" else language |
| | | return request().autocomplete(IGoApplication.tripId,key,lan,"country:$country") |
| | | return googleRequest().autocomplete(IGoApplication.tripId,key,lan,"country:$country") |
| | | } |
| | | |
| | | /** |
| | | * 搜索2:获取经纬度 |
| | | */ |
| | | fun placeDetails(placeId:String): Flowable<PlaceDetailBean> { |
| | | return request().placeDetails(IGoApplication.tripId,placeId) |
| | | return googleRequest().placeDetails(IGoApplication.tripId,placeId) |
| | | } |
| | | |
| | | /** |
| | |
| | | fun directions(startLat: Double,startLon: Double,endLat: Double,endLon: Double): Flowable<RouteBean> { |
| | | val language = LanguageUtil.getLanguage() |
| | | val lan = if (language == Const.Language.CHINESE) "zh-CN" else language |
| | | return request().directions(IGoApplication.tripId,"${startLat},${startLon}","${endLat},${endLon}",lan) |
| | | return googleRequest().directions(IGoApplication.tripId,"${startLat},${startLon}","${endLat},${endLon}",lan) |
| | | } |
| | | |
| | | /** |