merge
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
package com.mogo.eagle.core.function.chat.facade.net
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonElement
|
||||
import com.google.gson.JsonObject
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.eagle.core.data.chat.UserInfo
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts
|
||||
import com.mogo.eagle.core.function.api.chat.biz.IMCallType.CALL_TYPE_VOICE
|
||||
import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi
|
||||
@@ -18,8 +15,8 @@ import com.mogo.eagle.core.function.chat.facade.net.bean.*
|
||||
import com.mogo.eagle.core.function.chat.facade.utils.log
|
||||
import com.mogo.map.MogoLocationClient
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import retrofit2.http.*
|
||||
import java.lang.IllegalStateException
|
||||
|
||||
|
||||
internal class ChatServiceModel {
|
||||
@@ -35,11 +32,12 @@ internal class ChatServiceModel {
|
||||
} ?: false
|
||||
}
|
||||
|
||||
suspend fun queryUserInfo(sn: String): Pair<Error?,UserInfo?>? {
|
||||
suspend fun queryUserInfo(sn: String): Pair<Error?, UserInfo?>? {
|
||||
val sns = arrayListOf(sn)
|
||||
val requestData = SnArrayRequestBody().also { it.sns = sns }
|
||||
return apiCall {
|
||||
getNetWorkApi(getConfig())?.queryUserInfoBySnS(requestData) ?: throw IllegalStateException("apis is null.")
|
||||
getNetWorkApi(getConfig())?.queryUserInfoBySnS(requestData)
|
||||
?: throw IllegalStateException("apis is null.")
|
||||
}.let { itx ->
|
||||
if (itx.code != 0 && itx.code != 200) {
|
||||
return@let Pair(Error(itx.code, itx.msg), null)
|
||||
@@ -84,11 +82,13 @@ internal class ChatServiceModel {
|
||||
map["data"] = Gson().toJson(params)
|
||||
return if (params.type == CALL_TYPE_VOICE.type) {
|
||||
apiCall {
|
||||
getNetWorkApi()?.requestConnectStatus(sn, map) ?: throw IllegalStateException("apis is null.")
|
||||
getNetWorkApi()?.requestConnectStatus(sn, map)
|
||||
?: throw IllegalStateException("apis is null.")
|
||||
}
|
||||
} else {
|
||||
apiCall {
|
||||
getNetWorkApi()?.requestVehicleTeamConnectStatus(map) ?: throw IllegalStateException("apis is null.")
|
||||
getNetWorkApi()?.requestVehicleTeamConnectStatus(map)
|
||||
?: throw IllegalStateException("apis is null.")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,8 @@ internal class ChatServiceModel {
|
||||
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["data"] = Gson().toJson(param)
|
||||
return apiCall {
|
||||
getNetWorkApi()?.inviteJoinVehicleTeam(map) ?: throw IllegalStateException("apis is null.")
|
||||
getNetWorkApi()?.inviteJoinVehicleTeam(map)
|
||||
?: throw IllegalStateException("apis is null.")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,8 +123,7 @@ internal class ChatServiceModel {
|
||||
}
|
||||
|
||||
private fun getNetWorkApi(baseUrl: String = ChatHttp.getBaseUrl()): HttpApi? {
|
||||
val serviceApi: IMogoServiceApis? = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation() as? IMogoServiceApis
|
||||
return serviceApi?.networkApi?.createNoCallAdapter(HttpApi::class.java, baseUrl)
|
||||
return MoGoRetrofitFactory.getInstanceNoCallAdapter(baseUrl).create(HttpApi::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,10 @@ internal interface HttpApi {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-chat-service/car/voiceRoom/no/operate/v1")
|
||||
suspend fun requestConnectStatus(@Query("sn") sn: String, @FieldMap connectStatus: Map<String, String>): BaseResponse<Any>
|
||||
suspend fun requestConnectStatus(
|
||||
@Query("sn") sn: String,
|
||||
@FieldMap connectStatus: Map<String, String>
|
||||
): BaseResponse<Any>
|
||||
|
||||
//邀请加入车队
|
||||
@FormUrlEncoded
|
||||
|
||||
Reference in New Issue
Block a user