Commit 5ae1ea18 by 刘鹏

feat : 星链 倾诉日志更改参数

parent 34f14462
...@@ -5,7 +5,7 @@ ext { ...@@ -5,7 +5,7 @@ ext {
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.49.25", "m-confide" : "0.0.49.28",
"m-consultant" : "0.0.60.03", "m-consultant" : "0.0.60.03",
"m-fm" : "0.0.30.04", "m-fm" : "0.0.30.04",
"m-user" : "0.0.61.94", "m-user" : "0.0.61.94",
...@@ -39,7 +39,7 @@ ext { ...@@ -39,7 +39,7 @@ ext {
"ydl-webview" : "0.0.38.47", "ydl-webview" : "0.0.38.47",
"ydl-media" : "0.0.21.42", "ydl-media" : "0.0.21.42",
"ydl-pay" : "0.0.18.19", "ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.46", "m-audioim" : "0.0.49.29.49",
"ydl-flutter-base": "0.0.14.38", "ydl-flutter-base": "0.0.14.38",
//以下 几乎不会动 //以下 几乎不会动
...@@ -88,7 +88,7 @@ ext { ...@@ -88,7 +88,7 @@ ext {
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.49.25", "m-confide" : "0.0.49.28",
"m-consultant" : "0.0.60.03", "m-consultant" : "0.0.60.03",
"m-fm" : "0.0.30.07", "m-fm" : "0.0.30.07",
"m-user" : "0.0.61.94", "m-user" : "0.0.61.94",
...@@ -114,14 +114,13 @@ ext { ...@@ -114,14 +114,13 @@ ext {
"m-dynamic-api" : "0.0.3.71", "m-dynamic-api" : "0.0.3.71",
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.40.77", "ydl-platform" : "0.0.40.77",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.47", "ydl-webview" : "0.0.38.47",
"ydl-media" : "0.0.21.42", "ydl-media" : "0.0.21.42",
"ydl-pay" : "0.0.18.19", "ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.46", "m-audioim" : "0.0.49.29.49",
"ydl-flutter-base": "0.0.14.38", "ydl-flutter-base": "0.0.14.38",
//以下 几乎不会动 //以下 几乎不会动
......
...@@ -26,7 +26,6 @@ import com.hjq.permissions.OnPermissionCallback ...@@ -26,7 +26,6 @@ import com.hjq.permissions.OnPermissionCallback
import com.hjq.permissions.XXPermissions import com.hjq.permissions.XXPermissions
import com.ydl.audioim.bean.AgoraLogInfoBean import com.ydl.audioim.bean.AgoraLogInfoBean
import com.ydl.audioim.contract.IAudioHomeActivityContract import com.ydl.audioim.contract.IAudioHomeActivityContract
import com.ydl.audioim.http.AudioApiRequestUtil
import com.ydl.audioim.http.command.ConnectCommand import com.ydl.audioim.http.command.ConnectCommand
import com.ydl.audioim.http.command.ConnectExceptionCommand import com.ydl.audioim.http.command.ConnectExceptionCommand
import com.ydl.audioim.http.command.NoticePushCommand import com.ydl.audioim.http.command.NoticePushCommand
...@@ -277,7 +276,7 @@ class AudioHomeActivity : ...@@ -277,7 +276,7 @@ class AudioHomeActivity :
override fun onRejoinChannelSuccess(channel: String?, uid: Int, elapsed: Int) { override fun onRejoinChannelSuccess(channel: String?, uid: Int, elapsed: Int) {
super.onRejoinChannelSuccess(channel, uid, elapsed) super.onRejoinChannelSuccess(channel, uid, elapsed)
callEventSave( "70", "$uid 用户声网加入频道成功:channel=$channel") callEventSave("70", "$uid 用户声网加入频道成功:channel=$channel")
LogUtil.e("[agora]$uid 用户声网重新加入频道成功:channel=$channel") LogUtil.e("[agora]$uid 用户声网重新加入频道成功:channel=$channel")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -312,7 +311,7 @@ class AudioHomeActivity : ...@@ -312,7 +311,7 @@ class AudioHomeActivity :
super.onConnectionStateChanged(state, reason) super.onConnectionStateChanged(state, reason)
// 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑 // 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑
if (reason == 3) { if (reason == 3) {
callEventSave( "60", "通话结束:网络连接被服务器中止 该情况现在是因为后端踢人逻辑,原因(${reason}") callEventSave("60", "通话结束:网络连接被服务器中止 该情况现在是因为后端踢人逻辑,原因(${reason}")
writeAgoraLog("通话结束:网络连接被服务器中止 该情况现在是因为后端踢人逻辑,原因(${reason})") writeAgoraLog("通话结束:网络连接被服务器中止 该情况现在是因为后端踢人逻辑,原因(${reason})")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
.sendRichLog( .sendRichLog(
...@@ -329,7 +328,7 @@ class AudioHomeActivity : ...@@ -329,7 +328,7 @@ class AudioHomeActivity :
override fun onLeaveChannel(stats: IRtcEngineEventHandler.RtcStats?) { override fun onLeaveChannel(stats: IRtcEngineEventHandler.RtcStats?) {
super.onLeaveChannel(stats) super.onLeaveChannel(stats)
callEventSave( "50", "离开频道回调stats=${stats}") callEventSave("50", "离开频道回调stats=${stats}")
LogUtil.e("[agora]离开频道回调") LogUtil.e("[agora]离开频道回调")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -341,7 +340,7 @@ class AudioHomeActivity : ...@@ -341,7 +340,7 @@ class AudioHomeActivity :
override fun onUserJoined(uid: Int, elapsed: Int) { override fun onUserJoined(uid: Int, elapsed: Int) {
super.onUserJoined(uid, elapsed) super.onUserJoined(uid, elapsed)
callEventSave( "40", "${uid}加入频道回调") callEventSave("40", "${uid}加入频道回调")
LogUtil.e("[agora]远端用户/主播加入频道回调") LogUtil.e("[agora]远端用户/主播加入频道回调")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.AGORA, "远端用户/主播加入频道回调") .sendRichLog(AliYunLogConfig.AGORA, "远端用户/主播加入频道回调")
...@@ -349,7 +348,7 @@ class AudioHomeActivity : ...@@ -349,7 +348,7 @@ class AudioHomeActivity :
override fun onUserOffline(uid: Int, elapsed: Int) { override fun onUserOffline(uid: Int, elapsed: Int) {
super.onUserOffline(uid, elapsed) super.onUserOffline(uid, elapsed)
callEventSave( "50", "uid:${uid}离开频道回调 elapsed:${elapsed}") callEventSave("50", "uid:${uid}离开频道回调 elapsed:${elapsed}")
LogUtil.e("[agora]远端用户$uid 离开频道回调") LogUtil.e("[agora]远端用户$uid 离开频道回调")
writeAgoraLog("接通后通话结束:对方已挂断") writeAgoraLog("接通后通话结束:对方已挂断")
...@@ -433,7 +432,7 @@ class AudioHomeActivity : ...@@ -433,7 +432,7 @@ class AudioHomeActivity :
initSensorManager() initSensorManager()
//页面传递数据初始化 //页面传递数据初始化
initIntentData() initIntentData()
callEventSave( "80", "通话页面打开") callEventSave("80", "通话页面打开")
writeAgoraLog("通话页面打开的时候,RTM登录状态码:${YDLavManager.sdkStatus}") writeAgoraLog("通话页面打开的时候,RTM登录状态码:${YDLavManager.sdkStatus}")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -493,7 +492,7 @@ class AudioHomeActivity : ...@@ -493,7 +492,7 @@ class AudioHomeActivity :
listenId = intent.getStringExtra(IntentConstants.INTENT_LISTEN_ID) listenId = intent.getStringExtra(IntentConstants.INTENT_LISTEN_ID)
commentUrl = intent.getStringExtra(IntentConstants.INTENT_COMMENT_URL) commentUrl = intent.getStringExtra(IntentConstants.INTENT_COMMENT_URL)
dialStatus = intent.getStringExtra(IntentConstants.INTENT_DIALSTATUS) dialStatus = intent.getStringExtra(IntentConstants.INTENT_DIALSTATUS)
callEventSave( "90", "专家的通话状态dialStatus:$dialStatus") callEventSave("90", "专家的通话状态dialStatus:$dialStatus")
writeAgoraLog("专家的通话状态dialStatus:$dialStatus", false) writeAgoraLog("专家的通话状态dialStatus:$dialStatus", false)
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -511,7 +510,7 @@ class AudioHomeActivity : ...@@ -511,7 +510,7 @@ class AudioHomeActivity :
listenId listenId
) )
val content = Gson().toJson(logBean) val content = Gson().toJson(logBean)
callEventSave( "80", "主叫方发送的邀请通话消息内容:$content") callEventSave("80", "主叫方发送的邀请通话消息内容:$content")
writeAgoraLog("主叫方发送的邀请通话消息内容:$content", true) writeAgoraLog("主叫方发送的邀请通话消息内容:$content", true)
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -522,7 +521,7 @@ class AudioHomeActivity : ...@@ -522,7 +521,7 @@ class AudioHomeActivity :
} }
private fun reLoginRTM() { private fun reLoginRTM() {
callEventSave( "80", "RMT状态:${YDLavManager.sdkStatus},重新登录RMT") callEventSave("80", "RMT状态:${YDLavManager.sdkStatus},重新登录RMT")
writeAgoraLog("RMT状态:${YDLavManager.sdkStatus},重新登录RMT") writeAgoraLog("RMT状态:${YDLavManager.sdkStatus},重新登录RMT")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -584,8 +583,6 @@ class AudioHomeActivity : ...@@ -584,8 +583,6 @@ class AudioHomeActivity :
return@setOnClickListener return@setOnClickListener
} }
if (isConnectSuccess) { if (isConnectSuccess) {
callEventSave( "50", "已接通:主叫主动挂断")
writeAgoraLog("已接通:主叫主动挂断") writeAgoraLog("已接通:主叫主动挂断")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.AGORA, "已接通:主叫主动挂断") .sendRichLog(AliYunLogConfig.AGORA, "已接通:主叫主动挂断")
...@@ -596,6 +593,7 @@ class AudioHomeActivity : ...@@ -596,6 +593,7 @@ class AudioHomeActivity :
} else { } else {
userCloseCalling() userCloseCalling()
} }
callEventSave("50", "已接通:主叫主动挂断")
ActionCountUtils.count( ActionCountUtils.count(
"shengwang_popup_layer_page|shengwang_popup_layer_refuse_click", "shengwang_popup_layer_page|shengwang_popup_layer_refuse_click",
...@@ -639,7 +637,7 @@ class AudioHomeActivity : ...@@ -639,7 +637,7 @@ class AudioHomeActivity :
.permission(com.hjq.permissions.Permission.RECORD_AUDIO) .permission(com.hjq.permissions.Permission.RECORD_AUDIO)
.request(object : OnPermissionCallback { .request(object : OnPermissionCallback {
override fun onGranted(p0: MutableList<String>?, p1: Boolean) { override fun onGranted(p0: MutableList<String>?, p1: Boolean) {
callEventSave( "80", "请求音频权限通过") callEventSave("80", "请求音频权限通过")
writeAgoraLog("请求音频权限通过") writeAgoraLog("请求音频权限通过")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -655,7 +653,7 @@ class AudioHomeActivity : ...@@ -655,7 +653,7 @@ class AudioHomeActivity :
YDLavManager.AUDIO_NO_AUTH_ERROR_CODE, YDLavManager.AUDIO_NO_AUTH_ERROR_CODE,
null null
) )
callEventSave( "80", "拒绝请求音频权限") callEventSave("80", "拒绝请求音频权限")
writeAgoraLog("拒绝请求音频权限") writeAgoraLog("拒绝请求音频权限")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -672,7 +670,7 @@ class AudioHomeActivity : ...@@ -672,7 +670,7 @@ class AudioHomeActivity :
}) })
} catch (e: Exception) { } catch (e: Exception) {
callEventSave( "80", "请求音频权限异常${e.message}") callEventSave("80", "请求音频权限异常${e.message}")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.AGORA, "请求音频权限异常${e.message}") .sendRichLog(AliYunLogConfig.AGORA, "请求音频权限异常${e.message}")
...@@ -725,7 +723,7 @@ class AudioHomeActivity : ...@@ -725,7 +723,7 @@ class AudioHomeActivity :
} }
}, { }, {
callEventSave( "80", "倒计时异常${it.message}") callEventSave("80", "倒计时异常${it.message}")
LogUtil.d(it.message) LogUtil.d(it.message)
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -735,7 +733,7 @@ class AudioHomeActivity : ...@@ -735,7 +733,7 @@ class AudioHomeActivity :
if (!isConnectSuccess) { if (!isConnectSuccess) {
//关闭音乐 //关闭音乐
stopPlaying() stopPlaying()
callEventSave( "50", "未接通挂断:50s等待倒计时结束挂断") callEventSave("50", "未接通挂断:50s等待倒计时结束挂断")
writeAgoraLog("未接通挂断:50s等待倒计时结束挂断") writeAgoraLog("未接通挂断:50s等待倒计时结束挂断")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -747,7 +745,7 @@ class AudioHomeActivity : ...@@ -747,7 +745,7 @@ class AudioHomeActivity :
channelId!!, channelId!!,
sendDoctocrMsg!! sendDoctocrMsg!!
) { msg, code -> ) { msg, code ->
callEventSave( "50", "未接听时:主叫(用户)主动挂断失败,msg=$msg($code),再次挂断") callEventSave("50", "未接听时:主叫(用户)主动挂断失败,msg=$msg($code),再次挂断")
writeAgoraLog("未接听时:主叫(用户)主动挂断失败,msg=$msg($code),再次挂断") writeAgoraLog("未接听时:主叫(用户)主动挂断失败,msg=$msg($code),再次挂断")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -789,7 +787,7 @@ class AudioHomeActivity : ...@@ -789,7 +787,7 @@ class AudioHomeActivity :
* 声网加入频道 * 声网加入频道
*/ */
fun joinChannel() { fun joinChannel() {
callEventSave( "40", "对方(专家)接受了通话邀请,主叫(用户)开始加入频道:$channelId") callEventSave("40", "对方(专家)接受了通话邀请,主叫(用户)开始加入频道:$channelId")
writeAgoraLog("对方(专家)接受了通话邀请,主叫(用户)开始加入频道:$channelId") writeAgoraLog("对方(专家)接受了通话邀请,主叫(用户)开始加入频道:$channelId")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -808,7 +806,7 @@ class AudioHomeActivity : ...@@ -808,7 +806,7 @@ class AudioHomeActivity :
* *
*/ */
private fun userCloseCalling() { private fun userCloseCalling() {
callEventSave( "50", "未接听时:主叫(用户)主动挂断,取消呼叫") callEventSave("50", "未接听时:主叫(用户)主动挂断,取消呼叫")
writeAgoraLog("未接听时:主叫(用户)主动挂断,取消呼叫") writeAgoraLog("未接听时:主叫(用户)主动挂断,取消呼叫")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -820,7 +818,7 @@ class AudioHomeActivity : ...@@ -820,7 +818,7 @@ class AudioHomeActivity :
channelId!!, channelId!!,
sendDoctocrMsg!! sendDoctocrMsg!!
) { msg, code -> ) { msg, code ->
callEventSave( "50", "未接听时:主叫(用户)主动挂断失败,msg=$msg($code),再次挂断") callEventSave("50", "未接听时:主叫(用户)主动挂断失败,msg=$msg($code),再次挂断")
writeAgoraLog("未接听时:主叫(用户)主动挂断失败,msg=$msg($code),再次挂断") writeAgoraLog("未接听时:主叫(用户)主动挂断失败,msg=$msg($code),再次挂断")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -870,7 +868,7 @@ class AudioHomeActivity : ...@@ -870,7 +868,7 @@ class AudioHomeActivity :
val dialog = val dialog =
AxbConfirmDialog(mContext, type, object : AxbConfirmDialog.OnClickEnsureListener { AxbConfirmDialog(mContext, type, object : AxbConfirmDialog.OnClickEnsureListener {
override fun onClickEnsure() { override fun onClickEnsure() {
callEventSave( "80", "主叫点击切换AXB按钮") callEventSave("80", "主叫点击切换AXB按钮")
writeAgoraLog("主叫点击切换AXB按钮") writeAgoraLog("主叫点击切换AXB按钮")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -896,7 +894,7 @@ class AudioHomeActivity : ...@@ -896,7 +894,7 @@ class AudioHomeActivity :
if (isConnectSuccess) { if (isConnectSuccess) {
uploadException("", "zhu", "108", object : YDLavManager.UploadExceptionCallback { uploadException("", "zhu", "108", object : YDLavManager.UploadExceptionCallback {
override fun onSuccess() { override fun onSuccess() {
callEventSave( "80", "离开房间成功,主叫切换AXB之后") callEventSave("80", "离开房间成功,主叫切换AXB之后")
writeAgoraLog("离开房间成功,主叫切换AXB之后") writeAgoraLog("离开房间成功,主叫切换AXB之后")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -933,7 +931,7 @@ class AudioHomeActivity : ...@@ -933,7 +931,7 @@ class AudioHomeActivity :
channelId!!, channelId!!,
sendDoctocrMsg!! sendDoctocrMsg!!
) { msg, code -> ) { msg, code ->
callEventSave( "80", "未接听时:主叫主动挂断失败,msg=$msg($code),再次挂断") callEventSave("50", "未接听时:主叫主动挂断失败,msg=$msg($code),再次挂断")
writeAgoraLog("未接听时:主叫主动挂断失败,msg=$msg($code),再次挂断") writeAgoraLog("未接听时:主叫主动挂断失败,msg=$msg($code),再次挂断")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
...@@ -1097,7 +1095,7 @@ class AudioHomeActivity : ...@@ -1097,7 +1095,7 @@ class AudioHomeActivity :
}, { }, {
LogUtil.d(it.message) LogUtil.d(it.message)
}, { }, {
callEventSave( "60", "倾诉时间已用完") callEventSave("60", "倾诉时间已用完")
YDLavManager.instances.callEndStatusUpdate(channelId!!, 3, "倾诉时间已用完") YDLavManager.instances.callEndStatusUpdate(channelId!!, 3, "倾诉时间已用完")
//注意:自动挂断时,如果对方离开频道的回调已经触发,就不要再重复调用接口 //注意:自动挂断时,如果对方离开频道的回调已经触发,就不要再重复调用接口
...@@ -1385,10 +1383,6 @@ class AudioHomeActivity : ...@@ -1385,10 +1383,6 @@ class AudioHomeActivity :
session: String? = channelId, session: String? = channelId,
line: String = "7" line: String = "7"
) { ) {
YDLavManager.instances.callEventSave(status, res, session, line)
AudioApiRequestUtil.callEventSave(session, line, status, res)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe()
} }
} }
...@@ -451,7 +451,8 @@ class YDLavManager { ...@@ -451,7 +451,8 @@ class YDLavManager {
if (TextUtils.isEmpty(userId) || userId ?: "0" <= "0") { if (TextUtils.isEmpty(userId) || userId ?: "0" <= "0") {
//如果uid为空或小于等于0 ,则不进行登录,因为uid为0也会登录成功,会导致后面uid正确时无法登录 //如果uid为空或小于等于0 ,则不进行登录,因为uid为0也会登录成功,会导致后面uid正确时无法登录
LogUtil.e("[agora]login-uid:$userId") LogUtil.e("[agora]login-uid:$userId")
AliYunRichLogsHelper.getInstance().sendRichLog(AliYunLogConfig.AGORA,"uid为空或小于等于0 ,则不进行登录 login-uid:$userId") AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.AGORA, "uid为空或小于等于0 ,则不进行登录 login-uid:$userId")
return return
} }
isOnlineRtm = true isOnlineRtm = true
...@@ -687,7 +688,10 @@ class YDLavManager { ...@@ -687,7 +688,10 @@ class YDLavManager {
override fun onMessageReceived(message: RTMMesssage, userId: Int) { override fun onMessageReceived(message: RTMMesssage, userId: Int) {
LogUtil.i("[agora]onMessageReceived:${message.text} -->uid:$userId") LogUtil.i("[agora]onMessageReceived:${message.text} -->uid:$userId")
AliYunRichLogsHelper.getInstance() AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.AGORA, "onMessageReceived:${message.text} -->uid:$userId") .sendRichLog(
AliYunLogConfig.AGORA,
"onMessageReceived:${message.text} -->uid:$userId"
)
} }
override fun onConnectionStateChanged(state: Int, reason: Int) { override fun onConnectionStateChanged(state: Int, reason: Int) {
...@@ -717,4 +721,23 @@ class YDLavManager { ...@@ -717,4 +721,23 @@ class YDLavManager {
} }
} }
} }
/**
* 倾诉日志
* @param session 通话业务id
* @param status 状态:01通话中(不影响通话的事件) 10:拨打 20未拨通 30未接通 40 接通 50挂断 60断线 70重连 80 呼叫方信号 90 被呼叫方信号
* @param res 上报的详细
* @param line 载体:1.网易 2.中国移动(双呼)3.联通 4.华为 5.糖猫-联通 7:声网 8:微信 10:新移动
* */
fun callEventSave(
status: String,
res: String,
session: String?,
line: String
) {
AudioApiRequestUtil.callEventSave(session, line, status, res)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe()
}
} }
\ No newline at end of file
package com.ydl.audioim.bean
/**
* 星链-倾诉日志请求参数
* */
data class CallEventRequestBody(
var session :String?,
var line :String,
var status :String,
var response :String,
var eventTime :String
)
...@@ -2,6 +2,7 @@ package com.ydl.audioim.http ...@@ -2,6 +2,7 @@ package com.ydl.audioim.http
import com.google.gson.Gson import com.google.gson.Gson
import com.ydl.audioim.bean.AgoraTokenResponse import com.ydl.audioim.bean.AgoraTokenResponse
import com.ydl.audioim.bean.CallEventRequestBody
import com.ydl.audioim.bean.ConnectBean import com.ydl.audioim.bean.ConnectBean
import com.ydl.audioim.http.command.ConnectCommand import com.ydl.audioim.http.command.ConnectCommand
import com.ydl.audioim.http.command.ConnectExceptionCommand import com.ydl.audioim.http.command.ConnectExceptionCommand
...@@ -71,7 +72,10 @@ class AudioApiRequestUtil { ...@@ -71,7 +72,10 @@ class AudioApiRequestUtil {
*/ */
fun connectException(param: ConnectExceptionCommand): Observable<BaseAPIResponse<Any>> { fun connectException(param: ConnectExceptionCommand): Observable<BaseAPIResponse<Any>> {
var str = Gson().toJson(param) var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) as RequestBody val body = RequestBody.create(
MediaType.parse("application/json; charset=utf-8"),
str
) as RequestBody
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).connectException(body) return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).connectException(body)
} }
...@@ -80,7 +84,10 @@ class AudioApiRequestUtil { ...@@ -80,7 +84,10 @@ class AudioApiRequestUtil {
*/ */
fun noticeServerPush(param: NoticePushCommand): Observable<BaseResponse<Any>> { fun noticeServerPush(param: NoticePushCommand): Observable<BaseResponse<Any>> {
var str = Gson().toJson(param) var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) as RequestBody val body = RequestBody.create(
MediaType.parse("application/json; charset=utf-8"),
str
) as RequestBody
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).noticeServerPush(body) return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).noticeServerPush(body)
} }
...@@ -95,19 +102,33 @@ class AudioApiRequestUtil { ...@@ -95,19 +102,33 @@ class AudioApiRequestUtil {
* 获取声网登录token * 获取声网登录token
*/ */
fun listenToken(cmd: ListenTokenCmd): Observable<BaseResponse<ListenTokenBean>> { fun listenToken(cmd: ListenTokenCmd): Observable<BaseResponse<ListenTokenBean>> {
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).listenToken(NetworkParamsUtils.getMaps(cmd)) return YDLHttpUtils.obtainApi(AudioNetAPi::class.java)
.listenToken(NetworkParamsUtils.getMaps(cmd))
} }
fun callEndStatusUpdate(channelId: String, endStatus: Int, msg: String): Observable<BaseAPIResponse<Any>> { fun callEndStatusUpdate(
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).callEndStatusUpdate(channelId, endStatus, msg) channelId: String,
endStatus: Int,
msg: String
): Observable<BaseAPIResponse<Any>> {
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java)
.callEndStatusUpdate(channelId, endStatus, msg)
} }
fun callEventSave( session: String?, fun callEventSave(
session: String?,
line: String, line: String,
status: String, status: String,
reponse: String): Observable<BaseAPIResponse<Any>> { response: String
): Observable<BaseAPIResponse<Any>> {
var eventTime = TimeUtil.getNowDatetime() var eventTime = TimeUtil.getNowDatetime()
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).callEventSave(session,eventTime,line,status,reponse) var param = CallEventRequestBody(session, line, status, response, eventTime);
var str = Gson().toJson(param)
val body = RequestBody.create(
MediaType.parse("application/json; charset=utf-8"),
str
) as RequestBody
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).callEventSave(body)
} }
} }
} }
\ No newline at end of file
...@@ -76,11 +76,5 @@ interface AudioNetAPi { ...@@ -76,11 +76,5 @@ interface AudioNetAPi {
//倾诉事件上报接口 //倾诉事件上报接口
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json") @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
@POST("call/v1/event/save") @POST("call/v1/event/save")
fun callEventSave( fun callEventSave(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
@Query("session") session: String?,
@Query("eventTime") eventTime: String,
@Query("line") line: String,
@Query("status") status: String,
@Query("reponse") reponse: String
): Observable<BaseAPIResponse<Any>>
} }
\ No newline at end of file
...@@ -24,7 +24,6 @@ import com.tbruyelle.rxpermissions2.RxPermissions ...@@ -24,7 +24,6 @@ import com.tbruyelle.rxpermissions2.RxPermissions
import com.ydl.audioim.BuildConfig import com.ydl.audioim.BuildConfig
import com.ydl.audioim.R import com.ydl.audioim.R
import com.ydl.audioim.YDLavManager import com.ydl.audioim.YDLavManager
import com.ydl.audioim.http.AudioApiRequestUtil
import com.ydl.audioim.http.command.ConnectExceptionCommand import com.ydl.audioim.http.command.ConnectExceptionCommand
import com.ydl.audioim.http.command.PayLoad import com.ydl.audioim.http.command.PayLoad
import com.ydl.audioim.player.AudioPlayer import com.ydl.audioim.player.AudioPlayer
...@@ -1111,10 +1110,6 @@ class ConsultantAudioHomeActivity : ...@@ -1111,10 +1110,6 @@ class ConsultantAudioHomeActivity :
session: String? = channelToken, session: String? = channelToken,
line: String = "7" line: String = "7"
) { ) {
YDLavManager.instances.callEventSave(status, res, session, line)
AudioApiRequestUtil.callEventSave(session, line, status, res)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe()
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment