Commit 870814a0 by 霍志良

Merge remote-tracking branch 'origin/最新Dev' into 最新Dev

# Conflicts:
#	config.gradle
parents 50b7ade0 93c16977
......@@ -5,7 +5,7 @@ ext {
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.49.25",
"m-confide" : "0.0.49.33",
"m-consultant" : "0.0.60.03",
"m-fm" : "0.0.30.04",
"m-user" : "0.0.61.94",
......@@ -39,7 +39,7 @@ ext {
"ydl-webview" : "0.0.38.47",
"ydl-media" : "0.0.21.42",
"ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.46",
"m-audioim" : "0.0.49.29.54",
"ydl-flutter-base": "0.0.14.38",
//以下 几乎不会动
......@@ -88,7 +88,7 @@ ext {
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.49.25",
"m-confide" : "0.0.49.33",
"m-consultant" : "0.0.60.03",
"m-fm" : "0.0.30.07",
"m-user" : "0.0.61.94",
......@@ -121,7 +121,7 @@ ext {
"ydl-webview" : "0.0.38.47",
"ydl-media" : "0.0.21.42",
"ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.46",
"m-audioim" : "0.0.49.29.54",
"ydl-flutter-base": "0.0.14.38",
//以下 几乎不会动
......
......@@ -451,7 +451,8 @@ class YDLavManager {
if (TextUtils.isEmpty(userId) || userId ?: "0" <= "0") {
//如果uid为空或小于等于0 ,则不进行登录,因为uid为0也会登录成功,会导致后面uid正确时无法登录
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
}
isOnlineRtm = true
......@@ -687,7 +688,10 @@ class YDLavManager {
override fun onMessageReceived(message: RTMMesssage, userId: Int) {
LogUtil.i("[agora]onMessageReceived:${message.text} -->uid:$userId")
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) {
......@@ -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
import com.google.gson.Gson
import com.ydl.audioim.bean.AgoraTokenResponse
import com.ydl.audioim.bean.CallEventRequestBody
import com.ydl.audioim.bean.ConnectBean
import com.ydl.audioim.http.command.ConnectCommand
import com.ydl.audioim.http.command.ConnectExceptionCommand
......@@ -32,9 +33,9 @@ class AudioApiRequestUtil {
*/
fun connectListen(cmd: ConnectCommand): Observable<BaseAPIResponse<ConnectBean>> {
return RxUtils.mapObservable(cmd)
.flatMap { it ->
YDLHttpUtils.obtainApi(AudioNetAPi::class.java).connectListen(it)
}
.flatMap { it ->
YDLHttpUtils.obtainApi(AudioNetAPi::class.java).connectListen(it)
}
}
/**
......@@ -71,7 +72,10 @@ class AudioApiRequestUtil {
*/
fun connectException(param: ConnectExceptionCommand): Observable<BaseAPIResponse<Any>> {
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)
}
......@@ -80,7 +84,10 @@ class AudioApiRequestUtil {
*/
fun noticeServerPush(param: NoticePushCommand): Observable<BaseResponse<Any>> {
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)
}
......@@ -95,19 +102,33 @@ class AudioApiRequestUtil {
* 获取声网登录token
*/
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>> {
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).callEndStatusUpdate(channelId, endStatus, msg)
fun callEndStatusUpdate(
channelId: String,
endStatus: Int,
msg: String
): Observable<BaseAPIResponse<Any>> {
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java)
.callEndStatusUpdate(channelId, endStatus, msg)
}
fun callEventSave( session: String?,
line: String,
status: String,
reponse: String): Observable<BaseAPIResponse<Any>> {
fun callEventSave(
session: String?,
line: String,
status: String,
response: String
): Observable<BaseAPIResponse<Any>> {
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 {
//倾诉事件上报接口
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
@POST("call/v1/event/save")
fun callEventSave(
@Query("session") session: String?,
@Query("eventTime") eventTime: String,
@Query("line") line: String,
@Query("status") status: String,
@Query("reponse") reponse: String
): Observable<BaseAPIResponse<Any>>
fun callEventSave(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
}
\ No newline at end of file
......@@ -24,7 +24,6 @@ import com.tbruyelle.rxpermissions2.RxPermissions
import com.ydl.audioim.BuildConfig
import com.ydl.audioim.R
import com.ydl.audioim.YDLavManager
import com.ydl.audioim.http.AudioApiRequestUtil
import com.ydl.audioim.http.command.ConnectExceptionCommand
import com.ydl.audioim.http.command.PayLoad
import com.ydl.audioim.player.AudioPlayer
......@@ -192,7 +191,7 @@ class ConsultantAudioHomeActivity :
override fun onUserJoined(uid: Int, elapsed: Int) {
super.onUserJoined(uid, elapsed)
callEventSave("80", "uid:${uid} 主叫(专家)加入声网频道成功")
callEventSave("40", "uid:${uid} 主叫(专家)加入声网频道成功")
LogUtil.e("[agora]远端用户加入频道回调")
writeAgoraLog("主叫(专家)加入声网频道成功")
......@@ -216,7 +215,7 @@ class ConsultantAudioHomeActivity :
super.onConnectionStateChanged(state, reason)
// 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑
if (reason == 3) {
callEventSave("50", "通话挂断:网络连接被服务器(后端)中止")
callEventSave("60", "通话挂断:网络连接被服务器(后端)中止")
showToast("对方已挂断")
YDLavManager.instances.callEndStatusUpdate(
......@@ -240,7 +239,7 @@ class ConsultantAudioHomeActivity :
*/
override fun onLeaveChannel(stats: IRtcEngineEventHandler.RtcStats?) {
super.onLeaveChannel(stats)
callEventSave("50", "自己离开频道回调")
callEventSave("52", "自己离开频道回调")
LogUtil.e("[agora]自己离开频道回调")
AliYunRichLogsHelper.getInstance().sendRichLog(AliYunLogConfig.AGORA, "自己离开频道回调")
......@@ -265,7 +264,7 @@ class ConsultantAudioHomeActivity :
LogUtil.e("[agora]$uid 主播离开频道回调")
when (elapsed) {
0 -> {
callEventSave("50", "用户主动离开")
callEventSave("52", "用户主动离开")
}
1 -> {
callEventSave(
......@@ -352,29 +351,29 @@ class ConsultantAudioHomeActivity :
showToast("请退出应用,重新打开")
close(RESULT_NOT_ANSWERED_CODE, "咨询师已挂断")
callEventSave(
"30",
"80",
"err:${err} 3:SDK 初始化失败|7:SDK 尚未初始化|109:当前使用的 Token 过期|110:生成的 Token 无效"
)
}
10 -> {
callEventSave("30", "err:${err} 专家网络较差")
callEventSave("80", "err:${err} 专家网络较差")
showToast("当前网络较差,请更换网络")
close(RESULT_NOT_ANSWERED_CODE, "专家网络较差")
}
101 -> {
callEventSave("30", "err:${err} 不是有效的 APP ID")
callEventSave("80", "err:${err} 不是有效的 APP ID")
showToast("安装包有问题,请联系技术")
close(RESULT_NOT_ANSWERED_CODE, "安装包有问题,请联系技术")
}
102 -> {
callEventSave("30", "err:${err} 不是有效的 频道名")
callEventSave("80", "err:${err} 不是有效的 频道名")
showToast("频道错误,请联系技术")
close(RESULT_NOT_ANSWERED_CODE, "频道错误,请联系技术")
}
123 -> {
callEventSave("30", "err:${err}此用户被服务器禁止")
callEventSave("80", "err:${err}此用户被服务器禁止")
// showToast("对方不允许接听电话,请联系客服")
// close(RESULT_NOT_ANSWERED_CODE, "该专家不允许接听电话,请联系客服")
......@@ -457,6 +456,8 @@ class ConsultantAudioHomeActivity :
override fun initDataAndEvent() {
EventBus.getDefault().register(this)
callEventSave("30", "进入接听界面")
//状态栏颜色
setWindowStatusBarColor()
//点亮屏幕 并解锁
......@@ -673,7 +674,7 @@ class ConsultantAudioHomeActivity :
}
override fun executeFinish() {
callEventSave("50", "对方已挂断")
callEventSave("51", "对方已挂断")
showToast("对方已挂断")
close(RESULT_ANSWERED_CODE, "")
......@@ -707,13 +708,13 @@ class ConsultantAudioHomeActivity :
private fun showStopService() {
if (status == STATUS_NOT_ANSWERED) {
YDLavManager.instances.callEndStatusUpdate(mAudioMessageBean?.channelId!!, 2, "被叫主动拒绝")
callEventSave("30", "通话未接通挂断:用户主动挂断")
callEventSave("51", "通话未接通挂断:用户主动挂断")
writeAgoraLog("通话未接通挂断:用户主动挂断")
//当未接听 直接挂断 要发送给老师一条消息
close(RESULT_NOT_ANSWERED_CODE, "用户已挂断")
} else if (status == STATUS_ANSWERED) {
callEventSave("50", "通话接通后挂断:专家主动挂断")
callEventSave("51", "通话接通后挂断:专家主动挂断")
YDLavManager.instances.callEndStatusUpdate(mAudioMessageBean?.channelId!!, 3, "被叫主动拒绝")
writeAgoraLog("通话接通后挂断:专家主动挂断")
......@@ -734,7 +735,7 @@ class ConsultantAudioHomeActivity :
return
}
showStopService()
callEventSave("50", "用户点击挂断按钮")
callEventSave("52", "用户点击挂断按钮")
writeAgoraLog("用户点击挂断按钮")
ActionCountUtils.count(
......@@ -777,7 +778,7 @@ class ConsultantAudioHomeActivity :
//停止震动
VibratorUtil.StopVibrate(this)
if (!canExcute) {
callEventSave("80", "对方已挂断")
callEventSave("51", "对方已挂断")
showToast("对方已挂断")
finish()
......@@ -1111,10 +1112,6 @@ class ConsultantAudioHomeActivity :
session: String? = channelToken,
line: String = "7"
) {
AudioApiRequestUtil.callEventSave(session, line, status, res)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe()
YDLavManager.instances.callEventSave(status, res, session, line)
}
}
......@@ -181,7 +181,7 @@ class ConfideWebServiceImpl {
expertInfo.remainingTime =
ExpertInfoBean.ListenRemainingTime(expertInfo.totalDuration);
}
YDLavManager.instances.callEventSave("10","用户点击拨打",expertInfo.channelId,"7")
ARouter.getInstance().build("/av/AudioHomeActivity")
.withString(IntentConstants.INTENT_EXPERT_HEAD_URL, expertInfo.expertHeadUrl)
.withString(IntentConstants.INTENT_EXPERT_NAME, expertInfo.expertName)
......
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