Commit 8b670006 by 霍志良

fix:修改专家挂断,用户界面没有销毁BUG,导致后台记录时长异常。增加dialStatus专家状态日志。

parent e9924424
...@@ -5,7 +5,7 @@ ext { ...@@ -5,7 +5,7 @@ ext {
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.48.81", "m-confide" : "0.0.48.82",
"m-consultant" : "0.0.59.36", "m-consultant" : "0.0.59.36",
"m-fm" : "0.0.30.00", "m-fm" : "0.0.30.00",
"m-user" : "0.0.60.34", "m-user" : "0.0.60.34",
...@@ -40,7 +40,7 @@ ext { ...@@ -40,7 +40,7 @@ ext {
"ydl-webview" : "0.0.38.33", "ydl-webview" : "0.0.38.33",
"ydl-media" : "0.0.21.6", "ydl-media" : "0.0.21.6",
"ydl-pay" : "0.0.18.13", "ydl-pay" : "0.0.18.13",
"m-audioim" : "0.0.49.29.13", "m-audioim" : "0.0.49.29.14",
"ydl-flutter-base": "0.0.14.20", "ydl-flutter-base": "0.0.14.20",
//以下 几乎不会动 //以下 几乎不会动
...@@ -89,7 +89,7 @@ ext { ...@@ -89,7 +89,7 @@ ext {
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.48.81", "m-confide" : "0.0.48.82",
"m-consultant" : "0.0.51.16", "m-consultant" : "0.0.51.16",
"m-fm" : "0.0.23.5", "m-fm" : "0.0.23.5",
"m-user" : "0.0.41.13", "m-user" : "0.0.41.13",
...@@ -121,7 +121,7 @@ ext { ...@@ -121,7 +121,7 @@ ext {
"ydl-webview" : "0.0.38.32", "ydl-webview" : "0.0.38.32",
"ydl-media" : "0.0.21.6", "ydl-media" : "0.0.21.6",
"ydl-pay" : "0.0.18.11", "ydl-pay" : "0.0.18.11",
"m-audioim" : "0.0.49.29.13", "m-audioim" : "0.0.49.29.14",
"ydl-flutter-base": "0.0.14.20", "ydl-flutter-base": "0.0.14.20",
//以下 几乎不会动 //以下 几乎不会动
......
...@@ -193,6 +193,11 @@ class AudioHomeActivity : ...@@ -193,6 +193,11 @@ class AudioHomeActivity :
private var hasUpLoadLog = false private var hasUpLoadLog = false
private var callStatus: Int = -1 private var callStatus: Int = -1
/**
* dialStatus 专家通话状态。
*/
private var dialStatus: String? = null
/** /**
* 声网事件回调 (SDK 通过指定的事件通知应用程序 SDK 的运行事件,如: 加入或离开频道,新用户加入频道等) * 声网事件回调 (SDK 通过指定的事件通知应用程序 SDK 的运行事件,如: 加入或离开频道,新用户加入频道等)
...@@ -326,8 +331,8 @@ class AudioHomeActivity : ...@@ -326,8 +331,8 @@ class AudioHomeActivity :
super.onConnectionStateChanged(state, reason) super.onConnectionStateChanged(state, reason)
// 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑 // 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑
if (reason == 3) { if (reason == 3) {
writeAgoraLog("通话结束:原因(${reason})") writeAgoraLog("通话结束:网络连接被服务器中止 该情况现在是因为后端踢人逻辑,原因(${reason})")
com.yidianling.common.tools.ToastUtil.toastShort("专家已挂断") // com.yidianling.common.tools.ToastUtil.toastShort("专家已挂断")
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
uploadLog() uploadLog()
leaveChannel() leaveChannel()
...@@ -355,7 +360,8 @@ class AudioHomeActivity : ...@@ -355,7 +360,8 @@ class AudioHomeActivity :
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
uploadLog() uploadLog()
showToast("专家已挂断") showToast("专家已挂断")
//UserOffLine之后,销毁界面,解决,userOffline有回调之后,onConnectionStateChanged(服务端踢人方法没有调),导致记录时长异常。
leaveChannel()
YDLavManager.instances.callEndStatusUpdate(channelId!!, 4, "对方离开频道") YDLavManager.instances.callEndStatusUpdate(channelId!!, 4, "对方离开频道")
if (totalDisposable != null) { if (totalDisposable != null) {
...@@ -477,6 +483,8 @@ class AudioHomeActivity : ...@@ -477,6 +483,8 @@ class AudioHomeActivity :
listenerUid = intent.getStringExtra(IntentConstants.INTENT_LISTENER_UID) listenerUid = intent.getStringExtra(IntentConstants.INTENT_LISTENER_UID)
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)
writeAgoraLog("专家的通话状态dialStatus:$dialStatus", isAppend = false)
isShowAXB = intent.getBooleanExtra(IntentConstants.INTENT_ISSHOWAXB, true) isShowAXB = intent.getBooleanExtra(IntentConstants.INTENT_ISSHOWAXB, true)
val logBean = AgoraLogInfoBean( val logBean = AgoraLogInfoBean(
......
...@@ -22,4 +22,5 @@ public interface IntentConstants { ...@@ -22,4 +22,5 @@ public interface IntentConstants {
String INTENT_LISTEN_ID= "intent_listen_id"; String INTENT_LISTEN_ID= "intent_listen_id";
String INTENT_COMMENT_URL= "intent_comment_url"; String INTENT_COMMENT_URL= "intent_comment_url";
String INTENT_ISSHOWAXB= "intent_isshowaxb"; String INTENT_ISSHOWAXB= "intent_isshowaxb";
String INTENT_DIALSTATUS="intent_dialstatus";
} }
...@@ -25,71 +25,109 @@ import com.yidianling.ydl_pay.pay.payDialog.ConfidePayParams ...@@ -25,71 +25,109 @@ import com.yidianling.ydl_pay.pay.payDialog.ConfidePayParams
import com.yidianling.ydl_pay.pay.payDialog.PayDialog import com.yidianling.ydl_pay.pay.payDialog.PayDialog
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
/** /**
* Created by haorui on 2019-10-10. * Created by haorui on 2019-10-10.
* Des: 对应主项目中的WebServiceImpl * Des: 对应主项目中的WebServiceImpl
*/ */
class ConfideWebServiceImpl{ class ConfideWebServiceImpl {
//倾诉支付弹窗 //倾诉支付弹窗
fun confidePayDialog(id: Int?, type : Int?, activity: Activity, confidePay : ConfidePayParams, callType:String?){ fun confidePayDialog(
id: Int?,
type: Int?,
activity: Activity,
confidePay: ConfidePayParams,
callType: String?
) {
PayDialog(activity) PayDialog(activity)
.setCallback(object : CallBack { .setCallback(object : CallBack {
override fun onSuccess() { override fun onSuccess() {
//支付成功,直接拨打 //支付成功,直接拨打
if (TextUtils.isEmpty(confidePay.confideUrl)){ if (TextUtils.isEmpty(confidePay.confideUrl)) {
connectionJava(id?:0,type?:1,activity,null,callType) connectionJava(id ?: 0, type ?: 1, activity, null, callType)
}else{ } else {
//倾诉订单列表页面过来,会有confideUrl值,则直接跳转此url //倾诉订单列表页面过来,会有confideUrl值,则直接跳转此url
NewH5Activity.start(activity, H5Params(confidePay.confideUrl!!,"")) NewH5Activity.start(activity, H5Params(confidePay.confideUrl!!, ""))
}
} }
}
override fun onError() { override fun onError() {
} }
}) })
.show(confidePay) .show(confidePay)
} }
//java版axb和声网接口 //java版axb和声网接口
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
fun connectionJava(id: Int, type : Int, activity: Activity, tellData : TellData?, callType:String?){ fun connectionJava(
ConfideHomeDataManager.getHttp().connectionJava(ConnectParamJava(""+id, ""+type,callType)) id: Int,
.subscribeOn(Schedulers.io()) type: Int,
.observeOn(AndroidSchedulers.mainThread()) activity: Activity,
.subscribe({ tellData: TellData?,
if ("200" == it.code){ callType: String?
if (it.data?.dialDetail?.dialStatus !=null){ ) {
if (100007 == it.data?.dialDetail?.dialStatus) { ConfideHomeDataManager.getHttp()
//支付弹窗 .connectionJava(ConnectParamJava("" + id, "" + type, callType))
//参数转换 .subscribeOn(Schedulers.io())
var confidePay = ConfidePayParams(it.data?.payTitle?:"倾诉服务",it.data?.listenOrderPrice,it.data?.coupon?.couponMoney?:0.00, .observeOn(AndroidSchedulers.mainThread())
it.data?.userBaseInfoRespDto?.availableMoney?:0.00,it.data?.payId?:"","","") .subscribe({
confidePayDialog(id,type,activity,confidePay,callType) if ("200" == it.code) {
} else if (100008 == it.data?.dialDetail?.dialStatus) { if (it.data?.dialDetail?.dialStatus != null) {
CommonDialog(activity) if (100007 == it.data?.dialDetail?.dialStatus) {
.setCancelAble(false) //支付弹窗
.setMessage(FinalString.TEL_BINDPHONE) //参数转换
.setLeftOnclick("忍痛放弃",null) var confidePay = ConfidePayParams(
.setRightClick("果断绑定") { view-> it.data?.payTitle ?: "倾诉服务",
try { it.data?.listenOrderPrice,
ModularServiceManager.provide(IUserService::class.java).wxBindToInputhonePage(activity) it.data?.coupon?.couponMoney ?: 0.00,
}catch (e: Exception) {} it.data?.userBaseInfoRespDto?.availableMoney ?: 0.00,
} it.data?.payId ?: "",
.show() "",
}else if(0==it.data?.dialDetail?.dialStatus){ ""
//连接成功 )
if (it.data?.dialDetail?.callConnectType?:-1==3){ confidePayDialog(id, type, activity, confidePay, callType)
//声网 } else if (100008 == it.data?.dialDetail?.dialStatus) {
it.data?.dialDetail?.agoraExpertInfo?:return@subscribe CommonDialog(activity)
callAgora(activity,id,it.data!!.dialDetail!!.agoraExpertInfo!!,it.data.callId?:"0",it.data.listenOrderId?:0L,tellData,it.data.isShowAxb) .setCancelAble(false)
}else{ .setMessage(FinalString.TEL_BINDPHONE)
//axb .setLeftOnclick("忍痛放弃", null)
val dialog = AxbConfirmDialog(activity,1,object :AxbConfirmDialog.OnClickEnsureListener{ .setRightClick("果断绑定") { view ->
try {
ModularServiceManager.provide(IUserService::class.java)
.wxBindToInputhonePage(activity)
} catch (e: Exception) {
}
}
.show()
} else if (0 == it.data?.dialDetail?.dialStatus) {
//连接成功
if (it.data?.dialDetail?.callConnectType ?: -1 == 3) {
//声网
it.data?.dialDetail?.agoraExpertInfo ?: return@subscribe
callAgora(
activity,
id,
it.data!!.dialDetail!!.agoraExpertInfo!!,
it.data.callId ?: "0",
it.data.listenOrderId ?: 0L,
tellData,
it.data.isShowAxb,
it.data?.dialDetail?.dialStatus.toString()
)
} else {
//axb
val dialog = AxbConfirmDialog(
activity,
1,
object : AxbConfirmDialog.OnClickEnsureListener {
override fun onClickEnsure() { override fun onClickEnsure() {
var phoneIntent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:${it.data?.dialDetail?.phoneNu?:0}")) var phoneIntent = Intent(
Intent.ACTION_DIAL,
Uri.parse("tel:${it.data?.dialDetail?.phoneNu ?: 0}")
)
activity.startActivity(phoneIntent) activity.startActivity(phoneIntent)
} }
...@@ -97,36 +135,45 @@ class ConfideWebServiceImpl{ ...@@ -97,36 +135,45 @@ class ConfideWebServiceImpl{
} }
}) })
dialog.show() dialog.show()
}
}else{
ToastHelper.show(it.data?.dialDetail?.dialReason?:"连接失败")
} }
}else{ } else {
ToastHelper.show(it.data?.dialDetail?.dialReason?:"连接失败") ToastHelper.show(it.data?.dialDetail?.dialReason ?: "连接失败")
} }
}else{ } else {
ToastHelper.show(it.msg) ToastHelper.show(it.data?.dialDetail?.dialReason ?: "连接失败")
} }
}, { } else {
ToastHelper.show(it.message?:"连接失败") ToastHelper.show(it.msg)
}) }
}, {
ToastHelper.show(it.message ?: "连接失败")
})
} }
//启动声网电话 //启动声网电话
private fun callAgora(activity: Activity, confideId:Int, expertInfo : ExpertInfoBean, call_id:String, relation_id:Long, tellData: TellData?,isShowAXB:Boolean){ private fun callAgora(
activity: Activity,
confideId: Int,
expertInfo: ExpertInfoBean,
call_id: String,
relation_id: Long,
tellData: TellData?,
isShowAXB: Boolean,
dialStatus: String
) {
//3G以下或者其他不确定异常能判断出来的 //3G以下或者其他不确定异常能判断出来的
if (!ConfideNetworkUtil.isWifiOr3G(activity)) { if (!ConfideNetworkUtil.isWifiOr3G(activity)) {
CommonDialog.create(activity) CommonDialog.create(activity)
.setTitle("温馨提示") .setTitle("温馨提示")
.setMessage("当前网络异常\n请使用普通电话拨打?") .setMessage("当前网络异常\n请使用普通电话拨打?")
.setLeftOnclick("暂不拨打") { .setLeftOnclick("暂不拨打") {
} }
.setRightClick("普通电话拨号") { .setRightClick("普通电话拨号") {
connectionJava(confideId,1,activity,tellData,"0") connectionJava(confideId, 1, activity, tellData, "0")
} }
.show() .show()
} else { } else {
if (expertInfo.listenerStatus != 1) { if (expertInfo.listenerStatus != 1) {
ToastHelper.show("老师正在通话中,请稍后重试") ToastHelper.show("老师正在通话中,请稍后重试")
...@@ -138,26 +185,31 @@ class ConfideWebServiceImpl{ ...@@ -138,26 +185,31 @@ class ConfideWebServiceImpl{
return return
} }
if(expertInfo.remainingTime?.remainingTime==null){ if (expertInfo.remainingTime?.remainingTime == null) {
expertInfo.remainingTime = ExpertInfoBean.ListenRemainingTime(expertInfo.totalDuration); expertInfo.remainingTime =
ExpertInfoBean.ListenRemainingTime(expertInfo.totalDuration);
} }
ARouter.getInstance().build("/av/AudioHomeActivity") ARouter.getInstance().build("/av/AudioHomeActivity")
.withString(IntentConstants.INTENT_EXPERT_HEAD_URL, expertInfo.expertHeadUrl) .withString(IntentConstants.INTENT_EXPERT_HEAD_URL, expertInfo.expertHeadUrl)
.withString(IntentConstants.INTENT_EXPERT_NAME, expertInfo.expertName) .withString(IntentConstants.INTENT_EXPERT_NAME, expertInfo.expertName)
.withString(IntentConstants.INTENT_EXPERT_TIPS, expertInfo.expertTips) .withString(IntentConstants.INTENT_EXPERT_TIPS, expertInfo.expertTips)
.withString(IntentConstants.INTENT_ROOM_ID, expertInfo.channelId) .withString(IntentConstants.INTENT_ROOM_ID, expertInfo.channelId)
.withString(IntentConstants.INTENT_REMAIN_TIME, expertInfo.remainingTime.remainingTime) .withString(
.withString(IntentConstants.INTENT_CALL_ID, call_id) IntentConstants.INTENT_REMAIN_TIME,
.withString(IntentConstants.INTENT_RELATION_ID, "${relation_id}") expertInfo.remainingTime.remainingTime
.withString(IntentConstants.INTENT_TOKEN, expertInfo.token) )
.withString(IntentConstants.INTENT_SIGNAL_TOKEN, expertInfo.signalToken) .withString(IntentConstants.INTENT_CALL_ID, call_id)
.withString(IntentConstants.INTENT_LISTENER_UID, expertInfo.listenerUid) .withString(IntentConstants.INTENT_RELATION_ID, "${relation_id}")
.withString(IntentConstants.INTENT_TOTAL_DURATION, expertInfo.totalDuration) .withString(IntentConstants.INTENT_TOKEN, expertInfo.token)
.withString(IntentConstants.INTENT_COMMENT_URL, expertInfo.commentUrl) .withString(IntentConstants.INTENT_SIGNAL_TOKEN, expertInfo.signalToken)
.withString(IntentConstants.INTENT_LISTEN_ID, confideId.toString()) .withString(IntentConstants.INTENT_LISTENER_UID, expertInfo.listenerUid)
.withBoolean(IntentConstants.INTENT_ISSHOWAXB,isShowAXB) .withString(IntentConstants.INTENT_TOTAL_DURATION, expertInfo.totalDuration)
.navigation(activity) .withString(IntentConstants.INTENT_COMMENT_URL, expertInfo.commentUrl)
.withString(IntentConstants.INTENT_LISTEN_ID, confideId.toString())
.withString(IntentConstants.INTENT_DIALSTATUS, dialStatus)
.withBoolean(IntentConstants.INTENT_ISSHOWAXB, isShowAXB)
.navigation(activity)
} }
} }
......
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