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
2c13748a
Commit
2c13748a
authored
Jan 18, 2024
by
zhengnw@sobot.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common 1.5.8 退出登录3
parent
f39482be
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
26 deletions
+33
-26
MainActivity.java
app/src/main/java/com/sobot/moduletest/MainActivity.java
+17
-18
SobotLoginTools.java
...src/main/java/com/sobot/common/login/SobotLoginTools.java
+16
-8
No files found.
app/src/main/java/com/sobot/moduletest/MainActivity.java
View file @
2c13748a
...
@@ -204,30 +204,29 @@ public class MainActivity extends SobotBaseActivity {
...
@@ -204,30 +204,29 @@ public class MainActivity extends SobotBaseActivity {
// });
// });
// }
// }
// Map<String, Object> map1 = new HashMap<>();
Map
<
String
,
Object
>
map1
=
new
HashMap
<>();
// map1.put("email", "zhengnw@sobot.com");
map1
.
put
(
"email"
,
"zhengnw@sobot.com"
);
// map1.put("passwd", "znw123456");
map1
.
put
(
"passwd"
,
"znw123456"
);
// map1.put("loginStatus", "1");
map1
.
put
(
"loginStatus"
,
"1"
);
// map1.put("from", 2 + "");
map1
.
put
(
"from"
,
2
+
""
);
// map1.put("way", "10");
map1
.
put
(
"way"
,
"10"
);
// map1.put("ack", "1");
map1
.
put
(
"ack"
,
"1"
);
// Map<String, String> headers1 = new HashMap<>();
Map
<
String
,
String
>
headers1
=
new
HashMap
<>();
// headers1.put("language", "zh");
headers1
.
put
(
"language"
,
"zh"
);
// HostModel hostModel=null;
// hostModel= SobotLoginTools.getInstance().getHostModel();
// SobotLoginTools.getInstance().doAppLogin(MainActivity.this, getSobotBaseContext(), "https://api-c.sobot.com/text","https://api-c.soboten.com/text", 8000, map1, headers1,"zhengnw@sobot.com","znw123456", new SobotResultBlock() {
// if(hostModel==null){
// hostModel=new HostModel();
// hostModel.setHost("https://api-c.sobot.com");
// SobotLoginTools.getInstance().setHostModel(hostModel);
// }
//
// SobotLoginTools.getInstance().doAppLogin(MainActivity.this, MainActivity.this, hostModel.getHost(),"https://api-c.soboten.com/text", 8000, map1, headers1, new SobotResultBlock() {
// @Override
// @Override
// public void resultBolok(SobotResultCode code, String msg, Object obj) {
// public void resultBolok(SobotResultCode code, String msg, Object obj) {
// SobotLoginTools.getInstance().checkExpiresToken();
// SobotLoginTools.getInstance().checkExpiresToken();
// SobotLogUtils.i(SobotLoginTools.getInstance().getAccessToken()+"");
// SobotLogUtils.i(SobotLoginTools.getInstance().getAccessToken()+"");
// SobotLogUtils.i(SobotLoginTools.getInstance().getTempId());
// SobotLogUtils.i(SobotLoginTools.getInstance().getTempId());
// SobotLogUtils.i(SobotLoginTools.getInstance().getToken()+"");
// SobotLogUtils.i(SobotLoginTools.getInstance().getToken()+"");
// SobotLoginTools.getInstance().logOut(MainActivity.this, "https://api-c.sobot.com/text", "zhengnw@sobot.com", new SobotResultBlock() {
// @Override
// public void resultBolok(SobotResultCode code, String msg, Object obj) {
//
// }
// });
// }
// }
// });
// });
...
...
sobot_common/src/main/java/com/sobot/common/login/SobotLoginTools.java
View file @
2c13748a
...
@@ -458,7 +458,18 @@ public class SobotLoginTools {
...
@@ -458,7 +458,18 @@ 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
))
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
"账号为空,退出失败"
,
null
);
}
return
;
}
if
(!
isLogin
(
loginAcount
))
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_SUCCEEDED
,
"上次登录的保存信息为空,不用再次退出登录"
,
null
);
}
return
;
}
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"loginUser"
,
loginAcount
);
params
.
put
(
"loginUser"
,
loginAcount
);
Map
<
String
,
String
>
headerParams
=
new
HashMap
<>();
Map
<
String
,
String
>
headerParams
=
new
HashMap
<>();
...
@@ -492,11 +503,6 @@ public class SobotLoginTools {
...
@@ -492,11 +503,6 @@ public class SobotLoginTools {
}
}
});
});
}
else
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
"账号为空,退出失败"
,
null
);
}
}
}
}
...
@@ -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