This commit is contained in:
lixiaopeng
2020-10-21 15:10:14 +08:00
parent 1d80b8145e
commit eedede61d1
7 changed files with 41 additions and 23 deletions

View File

@@ -203,6 +203,7 @@ class CosStatusController : CosStatusCallback {
//开始上传
entity?.isCustom?.let {
mainServiceHttpModel.sendInformationMessage(
fromType = mFromType,
type = type,
url = map,
isCustom = it,
@@ -227,15 +228,14 @@ class CosStatusController : CosStatusCallback {
}
}
} else {
// if (type == INFO_TYPE_VIDEO) {
// TipToast.shortTip("分享失败,请检查网络")
// }
}
}
}
}
override fun onProgress(localPath: String?, progress: Float) {
}

View File

@@ -218,16 +218,6 @@ class MainService : Service() {
// sendBroadcast(intent)
}
private fun sendUgcStatusReceiver(id: String?, type: String?, fromType: String?) {
Log.e("MainService", "sendUgcStatusReceiver ----> id = $id ---type = $type --fromType = $fromType ")
var intent = Intent()
intent.action = "com.zhidao.roadcondition.marker.info"
intent.putExtra("id", id)
intent.putExtra("type", type)
intent.putExtra("fromType", fromType)
sendBroadcast(intent)
}
/**
* 初始化定位监听
*/

View File

@@ -1,11 +1,9 @@
package com.zhidao.roadcondition.service
import android.content.Intent
import android.util.Log
import com.mogo.commons.AbsMogoApplication
import com.zhidao.roadcondition.event.GetImageSuccessEvent
import com.zhidao.roadcondition.event.LatLngStickyEventBus
import com.zhidao.roadcondition.model.*
import com.zhidao.roadcondition.model.proxy.INFO_TYPE_VIDEO
import com.zhidao.roadcondition.net.request
import com.zhidao.roadcondition.util.*
import com.zhidao.roadcondition.util.StrategyPreferenceUtil.Companion.setStrategyFrequency
@@ -25,6 +23,8 @@ class MainServiceController {
//逆地理编码是否重试
private var geoRetryed = false
private var mFromType: String = ""
private var mPoiType: String = ""
private val strategyeModel by lazy { StrategyServiceModel() }
@@ -224,6 +224,7 @@ class MainServiceController {
//上传情报数据
fun sendInformationMessage(
type: Int,
fromType: String,
url: Map<String, String>,
isCustom: Boolean = false,
trafficInfoType:String = "",
@@ -234,7 +235,10 @@ class MainServiceController {
latitude: Double,
customSend: ((Boolean) -> Unit)? = null
) {
Log.d(TAG, " sendInformationMessage poiType = $poiType")
Log.d(TAG, " sendInformationMessage poiType = $poiType -- fromType = $fromType")
mFromType = fromType
mPoiType = poiType
//删除测试数据
var locationInfo = LocationUtil.getInstance().getLocationInfo()
if (locationInfo.address.isNullOrEmpty()) {
@@ -297,12 +301,16 @@ class MainServiceController {
customSend: ((Boolean) -> Unit)? = null
) {
trackUploadServer(3)
request<BaseResponse<Any>> {
request<BaseResponse<UploadResult>> {
loader {
strategyeModel.uploadInformation(informationBody)
}
onSuccess {
Log.i(TAG, "upload message success ")
if (it.result != null) {
Log.i(TAG, "upload message success id" + it.result.id)
sendUgcStatusReceiver(it.result.id, mPoiType, mFromType)
}
trackUploadServer(1)
// CosStatusController().videoAndThumbMap.clear()
customSend?.invoke(true)
@@ -310,12 +318,23 @@ class MainServiceController {
onError {
Log.i(TAG, "$it upload message ${it.message}")
trackUploadServer(2)
sendUgcStatusReceiver(0, mPoiType, mFromType)
// CosStatusController().videoAndThumbMap.clear()
customSend?.invoke(false)
}
}
}
private fun sendUgcStatusReceiver(id: Long, type: String?, fromType: String?) {
Log.e(TAG, "sendUgcStatusReceiver ----> id = $id ---type = $type --fromType = $fromType ")
var intent = Intent()
intent.action = "com.v2x.ugc.upload.status"
intent.putExtra("id", id)
intent.putExtra("type", type)
intent.putExtra("fromType", fromType)
AbsMogoApplication.getApp().applicationContext.sendBroadcast(intent)
}
//上传服务器
private fun trackUploadServer(type: Int) {
trackNormalEvent(