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
d8c575b4
Commit
d8c575b4
authored
Sep 07, 2023
by
zhengnw@sobot.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common 1.4.0 登录添加openapihost 用于获取accesstoken,不传,不获取 直接登录
parent
cae3f207
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
18 deletions
+33
-18
MainActivity.java
app/src/main/java/com/sobot/moduletest/MainActivity.java
+3
-3
sobot-common-publish-mavencentral.gradle
sobot_common/sobot-common-publish-mavencentral.gradle
+1
-1
SobotLoginTools.java
...src/main/java/com/sobot/common/login/SobotLoginTools.java
+29
-14
No files found.
app/src/main/java/com/sobot/moduletest/MainActivity.java
View file @
d8c575b4
...
...
@@ -200,7 +200,7 @@ public class MainActivity extends SobotBaseActivity {
// }
Map
<
String
,
Object
>
map1
=
new
HashMap
<>();
map1
.
put
(
"email"
,
"zhengn
awei
@sobot.com"
);
map1
.
put
(
"email"
,
"zhengn
w
@sobot.com"
);
map1
.
put
(
"passwd"
,
"znw123456"
);
map1
.
put
(
"loginStatus"
,
"1"
);
map1
.
put
(
"from"
,
2
+
""
);
...
...
@@ -209,7 +209,7 @@ public class MainActivity extends SobotBaseActivity {
Map
<
String
,
String
>
headers1
=
new
HashMap
<>();
headers1
.
put
(
"language"
,
"zh"
);
// SobotLoginTools.getInstance().doAppLogin(MainActivity.this, MainActivity.this, "https://api-c.soboten.com/text", 8000, map1, headers1, new SobotResultBlock() {
// SobotLoginTools.getInstance().doAppLogin(MainActivity.this, MainActivity.this, "https://api-c.sobot
.com/text","https://api-c.sobot
en.com/text", 8000, map1, headers1, new SobotResultBlock() {
// @Override
// public void resultBolok(SobotResultCode code, String msg, Object obj) {
// SobotLoginTools.getInstance().checkExpiresToken();
...
...
@@ -224,7 +224,7 @@ public class MainActivity extends SobotBaseActivity {
// SobotServiceInfoModel ccc=new SobotServiceInfoModel();
// SobotLoginTools.getInstance().setServiceInfo(ccc);
// SobotLoginTools.getInstance().doLogin(MainActivity.this, MainActivity.this, "https://api-c.sobot
en.com/text", "zhengnawei
@sobot.com", "znw123456","", new SobotResultBlock() {
// SobotLoginTools.getInstance().doLogin(MainActivity.this, MainActivity.this, "https://api-c.sobot
.com/text","https://api-c.soboten.com", "zhengnw
@sobot.com", "znw123456","", new SobotResultBlock() {
// @Override
// public void resultBolok(SobotResultCode code, String msg, Object obj) {
// SobotLoginTools.getInstance().checkExpiresToken();
...
...
sobot_common/sobot-common-publish-mavencentral.gradle
View file @
d8c575b4
...
...
@@ -13,7 +13,7 @@ ext {
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_ARTIFACT_ID
=
'sobotcommon'
//项目名
// PUBLISH_ARTIFACT_ID = 'sobotcommon_x' //项目名
PUBLISH_VERSION
=
'1.
3.9.6
'
//版本号
PUBLISH_VERSION
=
'1.
4.0
'
//版本号
}
...
...
sobot_common/src/main/java/com/sobot/common/login/SobotLoginTools.java
View file @
d8c575b4
...
...
@@ -88,6 +88,27 @@ public class SobotLoginTools {
}
}
private
HostModel
mHostModel
;
//获取域名
public
HostModel
getHostModel
()
{
if
(
mHostModel
==
null
)
{
mHostModel
=
HostManager
.
getInstance
().
getHost
();
}
return
mHostModel
;
}
public
void
setServiceInfo
(
HostModel
newHostModel
)
{
HostManager
.
getInstance
().
deleteAll
();
mHostModel
=
newHostModel
;
if
(
mHostModel
!=
null
)
{
HostManager
.
getInstance
().
insert
(
mHostModel
);
}
else
{
HostManager
.
getInstance
().
deleteAll
();
}
}
//呼叫 v6 获取 accessToken
public
String
getAccessToken
()
{
if
(
getLoginUser
()
!=
null
)
{
...
...
@@ -133,15 +154,8 @@ public class SobotLoginTools {
}
/**
* 获取域名信息
*/
public
HostModel
getHostModel
()
{
return
HostManager
.
getInstance
().
getHost
();
}
// 执行APP登录接口
public
void
doAppLogin
(
final
Object
cancelTag
,
final
Context
mContext
,
final
String
host
,
long
timeout
,
Map
<
String
,
Object
>
params
,
Map
<
String
,
String
>
headers
,
final
SobotResultBlock
resultBlock
)
{
public
void
doAppLogin
(
final
Object
cancelTag
,
final
Context
mContext
,
final
String
host
,
final
String
openApiHost
,
long
timeout
,
Map
<
String
,
Object
>
params
,
Map
<
String
,
String
>
headers
,
final
SobotResultBlock
resultBlock
)
{
SobotHttpUtils
.
doPost
(
cancelTag
,
host
+
"/chat-sdk/sdk/admin/v1/login.action"
,
timeout
,
params
,
headers
,
new
HttpBaseUtils
.
StringCallBack
()
{
@Override
public
void
onResponse
(
String
result
)
{
...
...
@@ -158,10 +172,10 @@ public class SobotLoginTools {
if
(
code
==
SobotResultCode
.
CODE_SUCCEEDED
)
{
SobotServiceInfoModel
serviceInfoModel
=
(
SobotServiceInfoModel
)
obj
;
if
(
serviceInfoModel
!=
null
)
{
if
(
serviceInfoModel
.
getCallV6Flag
()
==
1
)
{
if
(
serviceInfoModel
.
getCallV6Flag
()
==
1
&&
!
SobotStringUtils
.
isEmpty
(
openApiHost
)
)
{
if
(
userEntity
!=
null
&&
!
SobotStringUtils
.
isEmpty
(
userEntity
.
getToken
()))
{
//如果是v6呼叫
String
tempHost
=
h
ost
;
String
tempHost
=
openApiH
ost
;
if
(
tempHost
.
contains
(
"/text"
))
{
tempHost
=
tempHost
.
replace
(
"/text"
,
""
);
}
...
...
@@ -216,8 +230,8 @@ public class SobotLoginTools {
});
}
// sdk 执行登录接口
public
void
doLogin
(
final
Object
cancelTag
,
final
Context
mContext
,
final
String
host
,
String
loginAcount
,
String
loginPwd
,
String
logintoken
,
final
SobotResultBlock
resultBlock
)
{
// sdk 执行登录接口
会获取accesstoken
public
void
doLogin
(
final
Object
cancelTag
,
final
Context
mContext
,
final
String
host
,
final
String
openApiHost
,
String
loginAcount
,
String
loginPwd
,
String
logintoken
,
final
SobotResultBlock
resultBlock
)
{
if
(
SobotStringUtils
.
isEmpty
(
logintoken
))
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"loginUser"
,
loginAcount
);
...
...
@@ -236,10 +250,10 @@ public class SobotLoginTools {
if
(
code
==
SobotResultCode
.
CODE_SUCCEEDED
)
{
SobotServiceInfoModel
serviceInfoModel
=
(
SobotServiceInfoModel
)
obj
;
if
(
serviceInfoModel
!=
null
)
{
if
(
serviceInfoModel
.
getCallV6Flag
()
==
1
)
{
if
(
serviceInfoModel
.
getCallV6Flag
()
==
1
&&
!
SobotStringUtils
.
isEmpty
(
openApiHost
)
)
{
if
(
userEntity
!=
null
&&
!
SobotStringUtils
.
isEmpty
(
userEntity
.
getToken
()))
{
//如果是v6呼叫
String
tempHost
=
h
ost
;
String
tempHost
=
openApiH
ost
;
if
(
tempHost
.
contains
(
"/text"
))
{
tempHost
=
tempHost
.
replace
(
"/text"
,
""
);
}
...
...
@@ -339,6 +353,7 @@ public class SobotLoginTools {
}
}
/**
* 调用座席接口
*
...
...
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