Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
Sobot_module_Dev
Project
Overview
Details
Activity
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
sobot_android
Sobot_module_Dev
Commits
88a9137f
Commit
88a9137f
authored
Jan 18, 2024
by
zhengnw@sobot.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common 1.5.8 退出登录3
parent
e19cd947
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
34 deletions
+42
-34
SobotLoginTools.java
...src/main/java/com/sobot/common/login/SobotLoginTools.java
+42
-34
No files found.
sobot_common/src/main/java/com/sobot/common/login/SobotLoginTools.java
View file @
88a9137f
...
@@ -458,45 +458,51 @@ public class SobotLoginTools {
...
@@ -458,45 +458,51 @@ public class SobotLoginTools {
// sdk 执行退出登录
// sdk 执行退出登录
public
void
logOut
(
Object
cancelTag
,
String
host
,
String
loginAcount
,
final
SobotResultBlock
resultBlock
)
{
public
void
logOut
(
Object
cancelTag
,
String
host
,
String
loginAcount
,
final
SobotResultBlock
resultBlock
)
{
if
(!
SobotStringUtils
.
isEmpty
(
loginAcount
)
&&
isLogin
(
loginAcount
))
{
if
(
SobotStringUtils
.
isEmpty
(
loginAcount
))
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
if
(
resultBlock
!=
null
)
{
params
.
put
(
"loginUser"
,
loginAcount
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
"账号为空,退出失败"
,
null
);
Map
<
String
,
String
>
headerParams
=
new
HashMap
<>();
}
headerParams
.
put
(
"temp-id"
,
getToken
());
return
;
headerParams
.
put
(
"from"
,
2
+
""
);
}
SobotHttpUtils
.
doPost
(
cancelTag
,
host
+
"/basic-login/serviceLogOut/4"
,
8000
,
params
,
headerParams
,
new
HttpBaseUtils
.
StringCallBack
()
{
if
(!
isLogin
(
loginAcount
))
{
@Override
if
(
resultBlock
!=
null
)
{
public
void
onResponse
(
String
response
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_SUCCEEDED
,
"上次登录的保存信息为空,不用再次退出登录"
,
null
);
SobotCallBaseCode
result
=
SobotGsonUtil
.
jsonToBean
(
response
,
SobotCallBaseCode
.
class
);
}
if
(
result
!=
null
&&
!
SobotStringUtils
.
isEmpty
(
result
.
getRetCode
())
&&
"000000"
.
equals
(
result
.
getRetCode
()))
{
return
;
clearLoginInfo
();
}
if
(
resultBlock
!=
null
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
"退出登录成功"
,
null
);
params
.
put
(
"loginUser"
,
loginAcount
);
}
Map
<
String
,
String
>
headerParams
=
new
HashMap
<>();
}
else
{
headerParams
.
put
(
"temp-id"
,
getToken
());
if
(
resultBlock
!=
null
)
{
headerParams
.
put
(
"from"
,
2
+
""
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
(
result
!=
null
&&
SobotStringUtils
.
isNoEmpty
(
result
.
getRetMsg
()))
?
result
.
getRetMsg
()
:
"退出登录失败"
,
null
);
SobotHttpUtils
.
doPost
(
cancelTag
,
host
+
"/basic-login/serviceLogOut/4"
,
8000
,
params
,
headerParams
,
new
HttpBaseUtils
.
StringCallBack
()
{
}
@Override
public
void
onResponse
(
String
response
)
{
SobotCallBaseCode
result
=
SobotGsonUtil
.
jsonToBean
(
response
,
SobotCallBaseCode
.
class
);
if
(
result
!=
null
&&
!
SobotStringUtils
.
isEmpty
(
result
.
getRetCode
())
&&
"000000"
.
equals
(
result
.
getRetCode
()))
{
clearLoginInfo
();
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
"退出登录成功"
,
null
);
}
}
}
}
else
{
@Override
public
void
onError
(
Exception
e
,
String
msg
,
int
responseCode
)
{
if
(
resultBlock
!=
null
)
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
msg
,
null
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
(
result
!=
null
&&
SobotStringUtils
.
isNoEmpty
(
result
.
getRetMsg
()))
?
result
.
getRetMsg
()
:
"退出登录失败"
,
null
);
}
}
}
}
}
@Override
@Override
public
void
inProgress
(
int
progress
)
{
public
void
onError
(
Exception
e
,
String
msg
,
int
responseCode
)
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
msg
,
null
);
}
}
});
}
else
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
"账号为空,退出失败"
,
null
);
}
}
}
@Override
public
void
inProgress
(
int
progress
)
{
}
});
}
}
...
@@ -509,7 +515,8 @@ public class SobotLoginTools {
...
@@ -509,7 +515,8 @@ public class SobotLoginTools {
* @param token
* @param token
* @param resultBlock
* @param resultBlock
*/
*/
public
void
getLoginUserInfo
(
final
Object
cancelTag
,
final
Context
mContext
,
final
String
host
,
String
token
,
String
language
,
final
SobotResultBlock
resultBlock
)
{
public
void
getLoginUserInfo
(
final
Object
cancelTag
,
final
Context
mContext
,
final
String
host
,
String
token
,
String
language
,
final
SobotResultBlock
resultBlock
)
{
final
String
url
=
host
+
"/basic-config-service/consoleAuth/queryAppAgentMenus"
;
final
String
url
=
host
+
"/basic-config-service/consoleAuth/queryAppAgentMenus"
;
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
if
(!
SobotStringUtils
.
isEmpty
(
token
))
{
if
(!
SobotStringUtils
.
isEmpty
(
token
))
{
...
@@ -607,7 +614,8 @@ public class SobotLoginTools {
...
@@ -607,7 +614,8 @@ public class SobotLoginTools {
* 获取accessToken
* 获取accessToken
*/
*/
public
void
doAccessToken
(
Object
cancelTag
,
String
host
,
String
token
,
final
SobotResultBlock
resultBlock
)
{
public
void
doAccessToken
(
Object
cancelTag
,
String
host
,
String
token
,
final
SobotResultBlock
resultBlock
)
{
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
if
(!
SobotStringUtils
.
isEmpty
(
token
))
{
if
(!
SobotStringUtils
.
isEmpty
(
token
))
{
headerMap
.
put
(
"temp-id"
,
token
);
headerMap
.
put
(
"temp-id"
,
token
);
...
...
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