Commit 9b9ead2f authored by yinjiacheng's avatar yinjiacheng

update C端调用B端API登录失效处理

parent 8539461b
......@@ -32,5 +32,7 @@ class XEventConfig {
const val SEARCH_PICKUP_POINT_START = "search_pickup_point_start"
// 申请退款成功
const val APPLY_REFUND_SUCCESS = "apply_refund_success"
// C端登录成功
const val CLIENT_C_LOGIN_SUCCESS = "client_c_login_success"
}
}
......@@ -4,13 +4,20 @@ import android.annotation.SuppressLint
import com.google.gson.JsonParseException
import com.yidian.bcommon.app.YdBaseApplication
import com.yidian.bcommon.constant.ResultCode
import com.yidian.bcommon.constant.XEventConfig
import com.yidian.bcommon.constant.XRouterPathConstants
import com.yidian.bcommon.sdk.ClientType
import com.yidian.bcommon.sdk.JudgeClientUtils
import com.yidian.bcommon.services.ZapServiceActionConstants
import com.yidian.bcommon.services.ZapServiceNameConstants
import com.yidian.utils.ToastUtil
import com.yidian.xarc.xevent.XBaseEvent
import com.yidian.xarc.xevent.XEventManager
import com.yidian.xpage.XPageManager
import com.yidian.yac.core.zap.ZapTicket
import io.reactivex.rxjava3.core.Observer
import io.reactivex.rxjava3.disposables.Disposable
import org.json.JSONObject
import java.lang.reflect.ParameterizedType
abstract class HttpResultSubscriber<T>(private var showProgress: Boolean = false) : Observer<HttpResult<Any?>> {
......@@ -57,9 +64,18 @@ abstract class HttpResultSubscriber<T>(private var showProgress: Boolean = false
onRequestSuccess(decodeResult)
}
ResultCode.INVALID -> {
// 登录失效 B端跳转登录页
// 登录失效 B端跳转登录页 C端登录成功后跳转管理中心
if (JudgeClientUtils.judgeClient(YdBaseApplication.context.packageName) == ClientType.MERCHANT_B) {
XPageManager.push(XRouterPathConstants.LOGIN_LIFE_CIRCLE, null)
} else {
ZapTicket(ZapServiceNameConstants.ClientInfoService).withAction(ZapServiceActionConstants.ActionGetLoginStatus).onResult {
val result = (it.result as JSONObject).optBoolean("loginStatus")
if (result) {
XPageManager.popTo(XRouterPathConstants.MERCHANT_CENTER, null)
// 通知登录成功
XEventManager.post(XBaseEvent(XEventConfig.CLIENT_C_LOGIN_SUCCESS, null))
}
}.ship()
}
}
else -> {
......
......@@ -66,5 +66,8 @@ class ZapServiceActionConstants {
// 获取当前位置信息
const val ActionGetCurrentLocation = "getCurrentLocation"
// 获取C端登录状态
const val ActionGetLoginStatus = "getLoginStatus"
}
}
......@@ -54,6 +54,13 @@ class ClientInfoService : ZapService() {
.put("latitude", 39.9885500)
)
}
// 获取C端登录状态
ZapServiceActionConstants.ActionGetLoginStatus -> {
resolver.success(
JSONObject()
.put("loginStatus", true)
)
}
}
}
......
......@@ -352,6 +352,10 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me
val accountName = event.body as String
viewBind.lvLifeAccountTitle.setLifeAccountName(accountName)
}
XEventConfig.CLIENT_C_LOGIN_SUCCESS -> {
// C端登录成功 刷新页面
viewBind.rlRefresh.autoRefresh()
}
}
}
......
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