opt
This commit is contained in:
@@ -3,6 +3,7 @@ package com.mogo.module.share.net
|
||||
import com.mogo.commons.data.BaseData
|
||||
import com.mogo.module.share.bean.AverateSpeedResponse
|
||||
import io.reactivex.Observable
|
||||
import okhttp3.RequestBody
|
||||
import retrofit2.http.*
|
||||
|
||||
/**
|
||||
@@ -19,6 +20,7 @@ interface ShareApiService {
|
||||
/**
|
||||
* 拥堵策略,上报平均速度
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/deva/car/path/no/poiStrategyCheck/v1")
|
||||
fun sendAverageSpeedForBlockStrategy(@FieldMap param:Map<String,String>):Observable<AverateSpeedResponse>
|
||||
fun sendAverageSpeedForBlockStrategy(@Body request:RequestBody):Observable<AverateSpeedResponse>
|
||||
}
|
||||
@@ -14,6 +14,10 @@ import com.mogo.service.tanlu.IMogoTanluProvider
|
||||
import com.mogo.service.tanlu.TanluUploadParams
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.mogo.utils.network.RequestOptions
|
||||
import com.mogo.utils.network.utils.GsonUtil
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import okhttp3.MediaType
|
||||
import okhttp3.RequestBody
|
||||
|
||||
|
||||
/**
|
||||
@@ -90,7 +94,8 @@ class BlockStrategy(private val context: Context, private val apis: IMogoService
|
||||
private fun uploadAverageSpeed(average: Float) {
|
||||
val params = ArrayMap<String, String>()
|
||||
params["speed"] = average.toString()
|
||||
val disposable = apis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendAverageSpeedForBlockStrategy(params).subscribe(object : SubscribeImpl<AverateSpeedResponse>(RequestOptions.create(context)) {
|
||||
val body = RequestBody.create(MediaType.parse("Content-type:application/json;charset=UTF-8"), GsonUtil.jsonFromObject(params))
|
||||
val disposable = apis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendAverageSpeedForBlockStrategy(body).subscribeOn(Schedulers.io()).subscribe(object : SubscribeImpl<AverateSpeedResponse>(RequestOptions.create(context)) {
|
||||
override fun onSuccess(response: AverateSpeedResponse?) {
|
||||
super.onSuccess(response)
|
||||
response?.let {
|
||||
|
||||
Reference in New Issue
Block a user