Commit 8b670006 by 霍志良

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

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