Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShenghuoquanBusiness
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
ShenghuoquanBusiness
Commits
9b9ead2f
Commit
9b9ead2f
authored
Sep 02, 2021
by
yinjiacheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update C端调用B端API登录失效处理
parent
8539461b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
1 deletion
+33
-1
XEventConfig.kt
...src/main/java/com/yidian/bcommon/constant/XEventConfig.kt
+2
-0
HttpResultSubscriber.kt
...main/java/com/yidian/bcommon/http/HttpResultSubscriber.kt
+17
-1
ZapServiceActionConstants.kt
.../com/yidian/bcommon/services/ZapServiceActionConstants.kt
+3
-0
ClientInfoService.kt
...om/yidian/shenghuoquan/bdemo/service/ClientInfoService.kt
+7
-0
MerchantCenterActivity.kt
...uoquan/bmanagercenter/ui/center/MerchantCenterActivity.kt
+4
-0
No files found.
CommonLib/BCommon/src/main/java/com/yidian/bcommon/constant/XEventConfig.kt
View file @
9b9ead2f
...
@@ -32,5 +32,7 @@ class XEventConfig {
...
@@ -32,5 +32,7 @@ class XEventConfig {
const
val
SEARCH_PICKUP_POINT_START
=
"search_pickup_point_start"
const
val
SEARCH_PICKUP_POINT_START
=
"search_pickup_point_start"
// 申请退款成功
// 申请退款成功
const
val
APPLY_REFUND_SUCCESS
=
"apply_refund_success"
const
val
APPLY_REFUND_SUCCESS
=
"apply_refund_success"
// C端登录成功
const
val
CLIENT_C_LOGIN_SUCCESS
=
"client_c_login_success"
}
}
}
}
CommonLib/BCommon/src/main/java/com/yidian/bcommon/http/HttpResultSubscriber.kt
View file @
9b9ead2f
...
@@ -4,13 +4,20 @@ import android.annotation.SuppressLint
...
@@ -4,13 +4,20 @@ import android.annotation.SuppressLint
import
com.google.gson.JsonParseException
import
com.google.gson.JsonParseException
import
com.yidian.bcommon.app.YdBaseApplication
import
com.yidian.bcommon.app.YdBaseApplication
import
com.yidian.bcommon.constant.ResultCode
import
com.yidian.bcommon.constant.ResultCode
import
com.yidian.bcommon.constant.XEventConfig
import
com.yidian.bcommon.constant.XRouterPathConstants
import
com.yidian.bcommon.constant.XRouterPathConstants
import
com.yidian.bcommon.sdk.ClientType
import
com.yidian.bcommon.sdk.ClientType
import
com.yidian.bcommon.sdk.JudgeClientUtils
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.utils.ToastUtil
import
com.yidian.xarc.xevent.XBaseEvent
import
com.yidian.xarc.xevent.XEventManager
import
com.yidian.xpage.XPageManager
import
com.yidian.xpage.XPageManager
import
com.yidian.yac.core.zap.ZapTicket
import
io.reactivex.rxjava3.core.Observer
import
io.reactivex.rxjava3.core.Observer
import
io.reactivex.rxjava3.disposables.Disposable
import
io.reactivex.rxjava3.disposables.Disposable
import
org.json.JSONObject
import
java.lang.reflect.ParameterizedType
import
java.lang.reflect.ParameterizedType
abstract
class
HttpResultSubscriber
<
T
>(
private
var
showProgress
:
Boolean
=
false
)
:
Observer
<
HttpResult
<
Any
?
>>
{
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
...
@@ -57,9 +64,18 @@ abstract class HttpResultSubscriber<T>(private var showProgress: Boolean = false
onRequestSuccess
(
decodeResult
)
onRequestSuccess
(
decodeResult
)
}
}
ResultCode
.
INVALID
->
{
ResultCode
.
INVALID
->
{
// 登录失效 B端跳转登录页
// 登录失效 B端跳转登录页
C端登录成功后跳转管理中心
if
(
JudgeClientUtils
.
judgeClient
(
YdBaseApplication
.
context
.
packageName
)
==
ClientType
.
MERCHANT_B
)
{
if
(
JudgeClientUtils
.
judgeClient
(
YdBaseApplication
.
context
.
packageName
)
==
ClientType
.
MERCHANT_B
)
{
XPageManager
.
push
(
XRouterPathConstants
.
LOGIN_LIFE_CIRCLE
,
null
)
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
->
{
else
->
{
...
...
CommonLib/BCommon/src/main/java/com/yidian/bcommon/services/ZapServiceActionConstants.kt
View file @
9b9ead2f
...
@@ -66,5 +66,8 @@ class ZapServiceActionConstants {
...
@@ -66,5 +66,8 @@ class ZapServiceActionConstants {
// 获取当前位置信息
// 获取当前位置信息
const
val
ActionGetCurrentLocation
=
"getCurrentLocation"
const
val
ActionGetCurrentLocation
=
"getCurrentLocation"
// 获取C端登录状态
const
val
ActionGetLoginStatus
=
"getLoginStatus"
}
}
}
}
Components/BDemo/src/main/java/com/yidian/shenghuoquan/bdemo/service/ClientInfoService.kt
View file @
9b9ead2f
...
@@ -54,6 +54,13 @@ class ClientInfoService : ZapService() {
...
@@ -54,6 +54,13 @@ class ClientInfoService : ZapService() {
.
put
(
"latitude"
,
39.9885500
)
.
put
(
"latitude"
,
39.9885500
)
)
)
}
}
// 获取C端登录状态
ZapServiceActionConstants
.
ActionGetLoginStatus
->
{
resolver
.
success
(
JSONObject
()
.
put
(
"loginStatus"
,
true
)
)
}
}
}
}
}
...
...
Components/BManagerCenter/src/main/java/com/yidian/shenghuoquan/bmanagercenter/ui/center/MerchantCenterActivity.kt
View file @
9b9ead2f
...
@@ -352,6 +352,10 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me
...
@@ -352,6 +352,10 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me
val
accountName
=
event
.
body
as
String
val
accountName
=
event
.
body
as
String
viewBind
.
lvLifeAccountTitle
.
setLifeAccountName
(
accountName
)
viewBind
.
lvLifeAccountTitle
.
setLifeAccountName
(
accountName
)
}
}
XEventConfig
.
CLIENT_C_LOGIN_SUCCESS
->
{
// C端登录成功 刷新页面
viewBind
.
rlRefresh
.
autoRefresh
()
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment