Commit 482512f5 by 霍志良

reactor:抽离变量

parent b88f7457
...@@ -53,7 +53,9 @@ import java.net.URLEncoder ...@@ -53,7 +53,9 @@ import java.net.URLEncoder
*/ */
object IMChatUtil { object IMChatUtil {
private var loadingDialog: LoadingDialogFragment? = null private var loadingDialog: LoadingDialogFragment? = null
private const val USER_TYPE_EXPERT=2//专家
private const val USER_TYPE_ASSISTANT=3//助理
private const val USER_TYPE_USER=1//用户
/** /**
* 接口数据请求完成回调 * 接口数据请求完成回调
*/ */
...@@ -125,7 +127,7 @@ object IMChatUtil { ...@@ -125,7 +127,7 @@ object IMChatUtil {
res.data!!.collectEvent res.data!!.collectEvent
) )
} }
if (TextUtils.equals(res.data!!.userType, "2")) { //专家 if (TextUtils.equals(res.data!!.userType, USER_TYPE_EXPERT.toString())) { //专家
//在uid用户类型确定为专家的情况下,根据uid调用接口判断是进入专家私聊还是助理私聊 //在uid用户类型确定为专家的情况下,根据uid调用接口判断是进入专家私聊还是助理私聊
getImJavaApi().getChatUid(toUid) getImJavaApi().getChatUid(toUid)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
...@@ -320,7 +322,7 @@ object IMChatUtil { ...@@ -320,7 +322,7 @@ object IMChatUtil {
expert.shareData.doctorName, expert.shareData.doctorName,
expert.shareData.cover expert.shareData.cover
) )
listener?.onSuccess(expert) listener.onSuccess(expert)
} else { } else {
upLoadLog("consult/get-expert", resp.code, resp.msg) upLoadLog("consult/get-expert", resp.code, resp.msg)
if (resp.code == ImConstants.HTTP_CODE_UNLOGIN) { if (resp.code == ImConstants.HTTP_CODE_UNLOGIN) {
...@@ -365,14 +367,14 @@ object IMChatUtil { ...@@ -365,14 +367,14 @@ object IMChatUtil {
tb.setmMinTitleVisiable(View.GONE) tb.setmMinTitleVisiable(View.GONE)
} else { } else {
//对方是用户,自己是助理 //对方是用户,自己是助理
if (actionHandler.userType == 1 && ModularServiceManager.provide(IUserService::class.java) if (actionHandler.userType == USER_TYPE_USER && ModularServiceManager.provide(IUserService::class.java)
.getUserInfo()?.user_type == 3 .getUserInfo()?.user_type == USER_TYPE_ASSISTANT
) { ) {
tb.setTitleTextRightIcon(R.drawable.user_info_icon) { tb.setTitleTextRightIcon(R.drawable.user_info_icon) {
messageFragment.showUserInfoDialog() messageFragment.showUserInfoDialog()
} }
} }
if (actionHandler.userType == 2) { // 专家 if (actionHandler.userType == USER_TYPE_EXPERT) { // 专家
tb.setmMinTitleVisiable(View.VISIBLE) tb.setmMinTitleVisiable(View.VISIBLE)
// 调取接口获取专家状态 // 调取接口获取专家状态
val dis = instance val dis = instance
...@@ -439,7 +441,7 @@ object IMChatUtil { ...@@ -439,7 +441,7 @@ object IMChatUtil {
) { throwable: Throwable -> ) { throwable: Throwable ->
LogUtil.i("getDoctorChatStatus throwable:$throwable") LogUtil.i("getDoctorChatStatus throwable:$throwable")
} }
} else if (actionHandler.userType == 3) { // 助理 } else if (actionHandler.userType == USER_TYPE_ASSISTANT) { // 助理
tb.setmMinTitleVisiable(View.GONE) tb.setmMinTitleVisiable(View.GONE)
// 调取接口获取助理状态 // 调取接口获取助理状态
instance.getAssistantChatStatus( instance.getAssistantChatStatus(
...@@ -478,9 +480,9 @@ object IMChatUtil { ...@@ -478,9 +480,9 @@ object IMChatUtil {
) { ) {
if (!(promptRule == 4 || promptRule == 5)) { if (!(promptRule == 4 || promptRule == 5)) {
val showExpertList = !(promptRule == 1 || promptRule == 3) val showExpertList = !(promptRule == 1 || promptRule == 3)
if (actionHandler.userType == 2 && status == 2) { //当该专家离线时 if (actionHandler.userType == USER_TYPE_EXPERT && status == 2) { //当该专家离线时
sendRecommendExpertListMessage(1, showExpertList, toUid, actionHandler) sendRecommendExpertListMessage(1, showExpertList, toUid, actionHandler)
} else if (actionHandler.userType == 2 && status >= 3) { //当该专家忙碌时 } else if (actionHandler.userType == USER_TYPE_EXPERT&& status >= 3) { //当该专家忙碌时
sendRecommendExpertListMessage(2, showExpertList, toUid, actionHandler) sendRecommendExpertListMessage(2, showExpertList, toUid, actionHandler)
} }
} }
......
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