18034727885
2026-08-19 1da9dab82c7014b8b535197bdfbdac862cc36e1a
修复问题
2个文件已添加
4个文件已修改
145 ■■■■■ 已修改文件
app/src/main/java/com/igo/user/network/ApiService.kt 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/igo/user/network/Apis.kt 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/igo/user/network/GoogleApiService.kt 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/igo/user/network/GoogleApis.kt 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/igo/user/network/HttpManager.kt 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/igo/user/network/RRetrofit.kt 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/igo/user/network/ApiService.kt
@@ -4,7 +4,6 @@
import com.google.gson.JsonObject
import com.igo.user.data.HomeDatas
import com.igo.user.network.entity.Anchor
import com.igo.user.network.entity.AutoCompleteBean
import com.igo.user.network.entity.CarPrice
import com.igo.user.network.entity.City
import com.igo.user.network.entity.Coupon
@@ -12,8 +11,6 @@
import com.igo.user.network.entity.EmailBean
import com.igo.user.network.entity.Evaluation
import com.igo.user.network.entity.Function
import com.igo.user.network.entity.GPoiBean
import com.igo.user.network.entity.GeoBean
import com.igo.user.network.entity.Goods
import com.igo.user.network.entity.GoogleToken
import com.igo.user.network.entity.InviteHis
@@ -25,11 +22,8 @@
import com.igo.user.network.entity.OpenCity
import com.igo.user.network.entity.Order
import com.igo.user.network.entity.Phone
import com.igo.user.network.entity.PlaceDetailBean
import com.igo.user.network.entity.Point
import com.igo.user.network.entity.RealName
import com.igo.user.network.entity.RouteBean
import com.igo.user.network.entity.SearchBean
import com.igo.user.network.entity.SeatInfo
import com.igo.user.network.entity.ServiceRecord
import com.igo.user.network.entity.Shift
@@ -377,30 +371,6 @@
    @POST(Apis.queryGoodsInfo)
    fun queryGoodsInfo(@Field("id") pageNum:Int,@Field("sign") sign:String,
                       @Field("appid") appid:String): Flowable<ResultData<Goods>>
    @POST(Apis.getPoi)
    fun getPoi(@Query("location")location:String,@Query("radius")radius:Int = 2000,@Query("key")key:String = Const.google_key,
               @Query("language")language:String): Flowable<GPoiBean>
    @POST(Apis.geoCode)
    fun geoCode(@Header("X-Goog-Maps-Experience-ID") tripId:String,@Query("latlng")location:String,@Query("language")language:String,@Query("key")key:String = Const.google_key,
                @Query("appid")appid:String = "c780a308a35740bfb946e10452ba62e0"): Flowable<GeoBean>
    @POST(Apis.textsearch)
    fun textsearch(@Header("X-Goog-Maps-Experience-ID") tripId:String,@Query("query")query:String,@Query("location")location:String?,
                   @Query("language")language:String,@Query("radius")radius:Int = 25000,@Query("key")key:String = Const.google_key): Flowable<SearchBean>
    @POST(Apis.autocomplete)
    fun autocomplete(@Header("X-Goog-Maps-Experience-ID") tripId:String,@Query("input")query:String, @Query("language")language:String,@Query("components")region:String="country:gh",
                     @Query("key")key:String = Const.google_key): Flowable<AutoCompleteBean>
    @POST(Apis.placeDetails)
    fun placeDetails(@Header("X-Goog-Maps-Experience-ID") tripId:String,@Query("place_id")place_id:String, @Query("fields")region:String="name,geometry",
                     @Query("key")key:String = Const.google_key): Flowable<PlaceDetailBean>
    @POST(Apis.directions)
    fun directions(@Header("X-Goog-Maps-Experience-ID") tripId:String,@Query("origin")origin:String,@Query("destination")destination:String,@Query("language")language:String,@Query("mode")mode:String = "driving",
                   @Query("key")key:String = Const.google_key): Flowable<RouteBean>
    @POST(Apis.getFleetEngineAuth)
    fun getFleetEngineAuth(@Query("tripId")origin:String): Flowable<ResultData<GoogleToken>>
app/src/main/java/com/igo/user/network/Apis.kt
@@ -145,18 +145,6 @@
    const val getEmailList = "api/user/getEmailList"
    const val queryRechargeRecord = "api/user/queryRechargeRecord"
    /**
     * Google
     */
    const val getPoi  = "https://maps.googleapis.com/maps/api/place/nearbysearch/json"
    const val geoCode  = "https://maps.googleapis.com/maps/api/geocode/json"
    const val textsearch  = "https://maps.googleapis.com/maps/api/place/textsearch/json"
    const val directions  = "https://maps.googleapis.com/maps/api/directions/json"
    const val autocomplete  = "https://maps.googleapis.com/maps/api/place/autocomplete/json"
    const val placeDetails  = "https://maps.googleapis.com/maps/api/place/details/json"
    const val getOrderDrivingData = "api/taxi/getOrderDrivingData" //服务中手动刷新下方行程数据
app/src/main/java/com/igo/user/network/GoogleApiService.kt
New file
@@ -0,0 +1,62 @@
package com.igo.user.network
import com.igo.user.network.entity.AutoCompleteBean
import com.igo.user.network.entity.GPoiBean
import com.igo.user.network.entity.GeoBean
import com.igo.user.network.entity.PlaceDetailBean
import com.igo.user.network.entity.RouteBean
import com.igo.user.network.entity.SearchBean
import com.igo.user.utils.Const
import io.reactivex.Flowable
import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.Query
interface GoogleApiService {
    @POST(GoogleApis.getPoi)
    fun getPoi(
        @Query("location") location: String, @Query("radius") radius: Int = 2000, @Query("key") key: String = Const.google_key,
        @Query("language") language: String
    ): Flowable<GPoiBean>
    @POST(GoogleApis.geoCode)
    fun geoCode(
        @Header("X-Goog-Maps-Experience-ID") tripId: String,
        @Query("latlng") location: String,
        @Query("language") language: String,
        @Query("key") key: String = Const.google_key,
        @Query("appid") appid: String = "c780a308a35740bfb946e10452ba62e0"
    ): Flowable<GeoBean>
    @POST(GoogleApis.textsearch)
    fun textsearch(
        @Header("X-Goog-Maps-Experience-ID") tripId: String, @Query("query") query: String, @Query("location") location: String?,
        @Query("language") language: String, @Query("radius") radius: Int = 25000, @Query("key") key: String = Const.google_key
    ): Flowable<SearchBean>
    @POST(GoogleApis.autocomplete)
    fun autocomplete(
        @Header("X-Goog-Maps-Experience-ID") tripId: String,
        @Query("input") query: String,
        @Query("language") language: String,
        @Query("components") region: String = "country:gh",
        @Query("key") key: String = Const.google_key
    ): Flowable<AutoCompleteBean>
    @POST(GoogleApis.placeDetails)
    fun placeDetails(
        @Header("X-Goog-Maps-Experience-ID") tripId: String, @Query("place_id") place_id: String, @Query("fields") region: String = "name,geometry",
        @Query("key") key: String = Const.google_key
    ): Flowable<PlaceDetailBean>
    @POST(GoogleApis.directions)
    fun directions(
        @Header("X-Goog-Maps-Experience-ID") tripId: String,
        @Query("origin") origin: String,
        @Query("destination") destination: String,
        @Query("language") language: String,
        @Query("mode") mode: String = "driving",
        @Query("key") key: String = Const.google_key
    ): Flowable<RouteBean>
}
app/src/main/java/com/igo/user/network/GoogleApis.kt
New file
@@ -0,0 +1,15 @@
package com.igo.user.network
/**
 * Google相关Api
 */
object GoogleApis {
    const val getPoi = "https://maps.googleapis.com/maps/api/place/nearbysearch/json"
    const val geoCode = "https://maps.googleapis.com/maps/api/geocode/json"
    const val textsearch = "https://maps.googleapis.com/maps/api/place/textsearch/json"
    const val directions = "https://maps.googleapis.com/maps/api/directions/json"
    const val autocomplete = "https://maps.googleapis.com/maps/api/place/autocomplete/json"
    const val placeDetails = "https://maps.googleapis.com/maps/api/place/details/json"
}
app/src/main/java/com/igo/user/network/HttpManager.kt
@@ -50,11 +50,17 @@
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)
    /**
@@ -1283,7 +1289,7 @@
        //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)
    }
    /**
@@ -1293,7 +1299,7 @@
        //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
    }
@@ -1304,14 +1310,14 @@
        //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)
    }
    /**
@@ -1320,7 +1326,7 @@
    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)
    }
    /**
app/src/main/java/com/igo/user/network/RRetrofit.kt
@@ -22,7 +22,7 @@
/**
 * 网络请求retrofit初始化。
 */
class RRetrofit private constructor() {
class RRetrofit(val isUseCert: Boolean = false) {
    private val loggingInterceptor by lazy {
        LoggingInterceptor()
@@ -106,8 +106,10 @@
                    chain.proceed(request)
                }
                .apply {
                    createTrustManager(R.raw.star_gopost_ci)?.also {
                        sslSocketFactory(getSSLSocketFactory(it), it)
                    if (isUseCert) {
                        createTrustManager(R.raw.star_gopost_ci)?.also {
                            sslSocketFactory(getSSLSocketFactory(it), it)
                        }
                    }
                    if (BuildConfig.DEBUG) {
                        addInterceptor(loggingInterceptor)
@@ -117,7 +119,7 @@
        .build()
    companion object {
        fun instance() = RRetrofit()
        fun instance(isUseCert: Boolean = true) = RRetrofit(isUseCert)
        fun getLanguageType(language: String): String {
            return when (language) {
                Const.Language.CHINESE -> "1"