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
b943125c
Commit
b943125c
authored
May 15, 2024
by
zhengnw@sobot.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common 1.7.6 不管accesstoken 和appLogin,只要queryAppAgentMenus 成功就可以登录成功
parent
64f2643e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
33 deletions
+49
-33
MainActivity.java
app/src/main/java/com/sobot/moduletest/MainActivity.java
+12
-11
build.gradle
sobot_common/build.gradle
+2
-2
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
+34
-19
No files found.
app/src/main/java/com/sobot/moduletest/MainActivity.java
View file @
b943125c
...
@@ -236,9 +236,10 @@ public class MainActivity extends SobotBaseActivity {
...
@@ -236,9 +236,10 @@ public class MainActivity extends SobotBaseActivity {
// }
// }
// });
// });
// SobotLoginTools.getInstance().loginWithAppkey(MainActivity.this, getSobotBaseContext(), true, "https://
test-branche1.sobot.com/text", "https://test-branche1.sobot.com", "zhengnw@zhichi.com", "UaH4q8JHj708", "615abf5432134e4992d4da2ba6f460db
", map1, new SobotResultBlock() {
// SobotLoginTools.getInstance().loginWithAppkey(MainActivity.this, getSobotBaseContext(), true, "https://
api-c.sobot.com/text", "https://api-c.soboten.com/text", "zhengnw@zhichi.com", "b83B6E072W29", "4ce7ca987fcf43beb17ed1eca84dd760
", map1, new SobotResultBlock() {
// @Override
// @Override
// public void resultBolok(SobotResultCode code, String msg, Object obj) {
// public void resultBolok(SobotResultCode code, String msg, Object obj) {
// SobotLogUtils.i(code.name() + "---------------------------------------");
// 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());
...
@@ -253,16 +254,16 @@ public class MainActivity extends SobotBaseActivity {
...
@@ -253,16 +254,16 @@ public class MainActivity extends SobotBaseActivity {
// SobotServiceInfoModel ccc=new SobotServiceInfoModel();
// SobotServiceInfoModel ccc=new SobotServiceInfoModel();
// SobotLoginTools.getInstance().setServiceInfo(ccc);
// SobotLoginTools.getInstance().setServiceInfo(ccc);
// SobotLoginTools.getInstance().doLogin(MainActivity.this, MainActivity.this, "https://api-c.sobot.com/text","https://api-c.soboten.com", "zhengnw@sobot.com", "znw123456",""
, new SobotResultBlock() {
SobotLoginTools
.
getInstance
().
doLogin
(
MainActivity
.
this
,
MainActivity
.
this
,
true
,
"https://api-c.sobot.com/text"
,
"https://api-c.sobot.com/tex"
,
"zhengnw@zhichi.com"
,
"znw123456"
,
map1
,
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(
);
SobotLogUtils
.
i
(
code
.
name
()
+
"---------------------------------------"
);
// SobotLogUtils.i(SobotLoginTools.getInstance().getAccessToken()+""
);
SobotLoginTools
.
getInstance
().
checkExpiresToken
(
);
// SobotLogUtils.i(SobotLoginTools.getInstance().getTempId()
);
SobotLogUtils
.
i
(
SobotLoginTools
.
getInstance
().
getAccessToken
()
+
""
);
// SobotLogUtils.i(SobotLoginTools.getInstance().getToken()+""
);
SobotLogUtils
.
i
(
SobotLoginTools
.
getInstance
().
getTempId
()
);
// SobotLogUtils.i(SobotLoginTools.getInstance().getServiceInfo().getTimezone()+"----------------------------------"+SobotLoginTools.getInstance().getServiceInfo().getTimezoneId()
);
SobotLogUtils
.
i
(
SobotLoginTools
.
getInstance
().
getToken
()
+
""
);
//
}
}
//
});
});
// Intent intent = new Intent(MainActivity.this, SobotWebViewActivity.class);
// Intent intent = new Intent(MainActivity.this, SobotWebViewActivity.class);
// intent.putExtra("url", "https://www.sobot.com/ticketclient/index.html?sysNum=75574e5fa29a48458d1f57ab5489a4c5&deployId=442eb27d9c5c4ab9a3a21023f82207a9");
// intent.putExtra("url", "https://www.sobot.com/ticketclient/index.html?sysNum=75574e5fa29a48458d1f57ab5489a4c5&deployId=442eb27d9c5c4ab9a3a21023f82207a9");
//// 是否隐藏头部导航栏 默认false显示, true 隐藏
//// 是否隐藏头部导航栏 默认false显示, true 隐藏
...
...
sobot_common/build.gradle
View file @
b943125c
...
@@ -11,7 +11,7 @@ android {
...
@@ -11,7 +11,7 @@ android {
//这里就是打jar包
//这里就是打jar包
task
makeJar
(
type:
Copy
)
{
task
makeJar
(
type:
Copy
)
{
//删除旧的jar包
//删除旧的jar包
delete
'build/libs/sobot_common_x_1.7.
5
.jar'
delete
'build/libs/sobot_common_x_1.7.
6
.jar'
//原地址
//原地址
from
(
'build/intermediates/packaged-classes/release/'
)
from
(
'build/intermediates/packaged-classes/release/'
)
//导出jar包的地址
//导出jar包的地址
...
@@ -19,7 +19,7 @@ android {
...
@@ -19,7 +19,7 @@ android {
//包含的jar包
//包含的jar包
include
(
'classes.jar'
)
include
(
'classes.jar'
)
//重命名jar包为mysdk
//重命名jar包为mysdk
rename
(
'classes.jar'
,
'sobot_common_x_1.7.5
.jar'
)
rename
(
'classes.jar'
,
'sobot_common_x_1.7.6
.jar'
)
}
}
makeJar
.
dependsOn
(
build
)
makeJar
.
dependsOn
(
build
)
}
}
...
...
sobot_common/sobot-common-publish-mavencentral.gradle
View file @
b943125c
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
ext
{
ext
{
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_ARTIFACT_ID
=
'sobotcommon_x'
//项目名
PUBLISH_ARTIFACT_ID
=
'sobotcommon_x'
//项目名
PUBLISH_VERSION
=
'1.7.
5
'
//版本号
PUBLISH_VERSION
=
'1.7.
6
'
//版本号
}
}
...
...
sobot_common/src/main/java/com/sobot/common/login/SobotLoginTools.java
View file @
b943125c
...
@@ -210,8 +210,8 @@ public class SobotLoginTools {
...
@@ -210,8 +210,8 @@ public class SobotLoginTools {
* @param resultBlock
* @param resultBlock
*/
*/
public
void
doLogin
(
final
Object
cancelTag
,
final
Context
mContext
,
final
boolean
isAppOrOnlineLogin
,
final
String
host
,
final
String
openApiHost
,
final
String
loginAcount
,
final
String
loginPwd
,
final
Map
<
String
,
Object
>
paramsMap
,
final
SobotResultBlock
resultBlock
)
{
public
void
doLogin
(
final
Object
cancelTag
,
final
Context
mContext
,
final
boolean
isAppOrOnlineLogin
,
final
String
host
,
final
String
openApiHost
,
final
String
loginAcount
,
final
String
loginPwd
,
final
Map
<
String
,
Object
>
paramsMap
,
final
SobotResultBlock
resultBlock
)
{
if
(
SobotStringUtils
.
isEmpty
(
host
)
||
SobotStringUtils
.
isEmpty
(
openApiHost
)
)
{
if
(
SobotStringUtils
.
isEmpty
(
host
))
{
SobotLogUtils
.
i
(
"host
或者 openApiHost
域名不能为空"
);
SobotLogUtils
.
i
(
"host 域名不能为空"
);
if
(
resultBlock
!=
null
)
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
"域名不能为空"
,
getServiceInfo
());
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
"域名不能为空"
,
getServiceInfo
());
}
}
...
@@ -246,7 +246,7 @@ public class SobotLoginTools {
...
@@ -246,7 +246,7 @@ public class SobotLoginTools {
serviceInfoModel
.
setToken
(
token
);
serviceInfoModel
.
setToken
(
token
);
serviceInfoModel
.
setLoginAccount
(
loginAcount
);
serviceInfoModel
.
setLoginAccount
(
loginAcount
);
serviceInfoModel
.
setLoginPwd
(
loginPwd
);
serviceInfoModel
.
setLoginPwd
(
loginPwd
);
if
((
serviceInfoModel
.
getCallV6Flag
()
==
1
||
SobotPermissionManager
.
isHasNewPermission
(
SobotPermissionManager
.
SCC
))
&&
!
SobotStringUtils
.
isEmpty
(
openApiHost
)
)
{
if
((
serviceInfoModel
.
getCallV6Flag
()
==
1
||
SobotPermissionManager
.
isHasNewPermission
(
SobotPermissionManager
.
SCC
)))
{
//如果是v6呼叫
//如果是v6呼叫
String
tempHost
=
openApiHost
;
String
tempHost
=
openApiHost
;
if
(
tempHost
.
contains
(
"/text"
))
{
if
(
tempHost
.
contains
(
"/text"
))
{
...
@@ -272,13 +272,15 @@ public class SobotLoginTools {
...
@@ -272,13 +272,15 @@ public class SobotLoginTools {
}
}
}
}
}
else
{
}
else
{
SobotLogUtils
.
i
(
"accessToken获取失败"
);
if
(
resultBlock
!=
null
)
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
FAILED
,
"登录失败 accessToken获取失败"
,
nul
l
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
SUCCEEDED
,
"登录成功"
,
tempServiceInfoMode
l
);
}
}
}
}
}
else
{
}
else
{
SobotLogUtils
.
i
(
"accessToken获取失败"
);
if
(
resultBlock
!=
null
)
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
FAILED
,
"登录失败"
,
nul
l
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
SUCCEEDED
,
"登录成功"
,
tempServiceInfoMode
l
);
}
}
}
}
}
}
...
@@ -345,8 +347,8 @@ public class SobotLoginTools {
...
@@ -345,8 +347,8 @@ public class SobotLoginTools {
* @param resultBlock
* @param resultBlock
*/
*/
public
void
loginWithAppkey
(
final
Object
cancelTag
,
final
Context
mContext
,
final
boolean
isAppOrOnlineLogin
,
final
String
host
,
final
String
openApiHost
,
final
String
loginAcount
,
String
appkey
,
String
appId
,
final
Map
<
String
,
Object
>
paramsMap
,
final
SobotResultBlock
resultBlock
)
{
public
void
loginWithAppkey
(
final
Object
cancelTag
,
final
Context
mContext
,
final
boolean
isAppOrOnlineLogin
,
final
String
host
,
final
String
openApiHost
,
final
String
loginAcount
,
String
appkey
,
String
appId
,
final
Map
<
String
,
Object
>
paramsMap
,
final
SobotResultBlock
resultBlock
)
{
if
(
SobotStringUtils
.
isEmpty
(
host
)
||
SobotStringUtils
.
isEmpty
(
openApiHost
)
)
{
if
(
SobotStringUtils
.
isEmpty
(
host
))
{
SobotLogUtils
.
i
(
"host
或者 openApiHost
域名不能为空"
);
SobotLogUtils
.
i
(
"host 域名不能为空"
);
if
(
resultBlock
!=
null
)
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
"域名不能为空"
,
getServiceInfo
());
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
"域名不能为空"
,
getServiceInfo
());
}
}
...
@@ -395,7 +397,7 @@ public class SobotLoginTools {
...
@@ -395,7 +397,7 @@ public class SobotLoginTools {
serviceInfoModel
.
setLogin_time
(
login_time
);
serviceInfoModel
.
setLogin_time
(
login_time
);
serviceInfoModel
.
setToken
(
token
);
serviceInfoModel
.
setToken
(
token
);
serviceInfoModel
.
setLoginAccount
(
loginAcount
);
serviceInfoModel
.
setLoginAccount
(
loginAcount
);
if
((
serviceInfoModel
.
getCallV6Flag
()
==
1
||
SobotPermissionManager
.
isHasNewPermission
(
SobotPermissionManager
.
SCC
))
&&
!
SobotStringUtils
.
isEmpty
(
openApiHost
)
)
{
if
((
serviceInfoModel
.
getCallV6Flag
()
==
1
||
SobotPermissionManager
.
isHasNewPermission
(
SobotPermissionManager
.
SCC
)))
{
//如果是v6呼叫
//如果是v6呼叫
String
tempHost
=
openApiHost
;
String
tempHost
=
openApiHost
;
if
(
tempHost
.
contains
(
"/text"
))
{
if
(
tempHost
.
contains
(
"/text"
))
{
...
@@ -421,13 +423,15 @@ public class SobotLoginTools {
...
@@ -421,13 +423,15 @@ public class SobotLoginTools {
}
}
}
}
}
else
{
}
else
{
SobotLogUtils
.
i
(
"accessToken获取失败"
);
if
(
resultBlock
!=
null
)
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
FAILED
,
"登录失败 accessToken获取失败"
,
nul
l
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
SUCCEEDED
,
"登录成功"
,
tempServiceInfoMode
l
);
}
}
}
}
}
else
{
}
else
{
SobotLogUtils
.
i
(
"accessToken获取失败"
);
if
(
resultBlock
!=
null
)
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
FAILED
,
"登录失败"
,
nul
l
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
SUCCEEDED
,
"登录成功"
,
tempServiceInfoMode
l
);
}
}
}
}
}
}
...
@@ -512,8 +516,8 @@ public class SobotLoginTools {
...
@@ -512,8 +516,8 @@ public class SobotLoginTools {
* @param resultBlock
* @param resultBlock
*/
*/
public
void
loginWithCompanyToken
(
final
Object
cancelTag
,
final
Context
mContext
,
final
boolean
isAppOrOnlineLogin
,
final
String
host
,
final
String
openApiHost
,
final
String
loginAcount
,
String
token
,
final
Map
<
String
,
Object
>
paramsMap
,
final
SobotResultBlock
resultBlock
)
{
public
void
loginWithCompanyToken
(
final
Object
cancelTag
,
final
Context
mContext
,
final
boolean
isAppOrOnlineLogin
,
final
String
host
,
final
String
openApiHost
,
final
String
loginAcount
,
String
token
,
final
Map
<
String
,
Object
>
paramsMap
,
final
SobotResultBlock
resultBlock
)
{
if
(
SobotStringUtils
.
isEmpty
(
host
)
||
SobotStringUtils
.
isEmpty
(
openApiHost
)
)
{
if
(
SobotStringUtils
.
isEmpty
(
host
))
{
SobotLogUtils
.
i
(
"host
或者 openApiHost
域名不能为空"
);
SobotLogUtils
.
i
(
"host域名不能为空"
);
if
(
resultBlock
!=
null
)
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
"域名不能为空"
,
getServiceInfo
());
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_FAILED
,
"域名不能为空"
,
getServiceInfo
());
}
}
...
@@ -548,7 +552,7 @@ public class SobotLoginTools {
...
@@ -548,7 +552,7 @@ public class SobotLoginTools {
serviceInfoModel
.
setLogin_time
(
login_time
);
serviceInfoModel
.
setLogin_time
(
login_time
);
serviceInfoModel
.
setToken
(
token
);
serviceInfoModel
.
setToken
(
token
);
serviceInfoModel
.
setLoginAccount
(
loginAcount
);
serviceInfoModel
.
setLoginAccount
(
loginAcount
);
if
((
serviceInfoModel
.
getCallV6Flag
()
==
1
||
SobotPermissionManager
.
isHasNewPermission
(
SobotPermissionManager
.
SCC
))
&&
!
SobotStringUtils
.
isEmpty
(
openApiHost
)
)
{
if
((
serviceInfoModel
.
getCallV6Flag
()
==
1
||
SobotPermissionManager
.
isHasNewPermission
(
SobotPermissionManager
.
SCC
)))
{
//如果是v6呼叫
//如果是v6呼叫
String
tempHost
=
openApiHost
;
String
tempHost
=
openApiHost
;
if
(
tempHost
.
contains
(
"/text"
))
{
if
(
tempHost
.
contains
(
"/text"
))
{
...
@@ -574,13 +578,15 @@ public class SobotLoginTools {
...
@@ -574,13 +578,15 @@ public class SobotLoginTools {
}
}
}
}
}
else
{
}
else
{
SobotLogUtils
.
i
(
"accessToken获取失败"
);
if
(
resultBlock
!=
null
)
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
FAILED
,
"登录失败 accessToken获取失败"
,
nul
l
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
SUCCEEDED
,
"登录成功"
,
tempServiceInfoMode
l
);
}
}
}
}
}
else
{
}
else
{
SobotLogUtils
.
i
(
"accessToken获取失败"
);
if
(
resultBlock
!=
null
)
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
FAILED
,
"登录失败"
,
nul
l
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
SUCCEEDED
,
"登录成功"
,
tempServiceInfoMode
l
);
}
}
}
}
}
}
...
@@ -803,6 +809,10 @@ public class SobotLoginTools {
...
@@ -803,6 +809,10 @@ public class SobotLoginTools {
if
(!
SobotStringUtils
.
isEmpty
(
token
))
{
if
(!
SobotStringUtils
.
isEmpty
(
token
))
{
headerMap
.
put
(
"temp-id"
,
token
);
headerMap
.
put
(
"temp-id"
,
token
);
}
}
if
(
SobotStringUtils
.
isEmpty
(
host
))
{
//获取accessToken 默认用腾讯云域名
host
=
"https://api-c.soboten.com"
;
}
headerMap
.
put
(
"from"
,
"2"
);
headerMap
.
put
(
"from"
,
"2"
);
SobotHttpUtils
.
doPost
(
cancelTag
,
host
+
"/tokens/getToken"
,
null
,
headerMap
,
new
HttpBaseUtils
.
StringCallBack
()
{
SobotHttpUtils
.
doPost
(
cancelTag
,
host
+
"/tokens/getToken"
,
null
,
headerMap
,
new
HttpBaseUtils
.
StringCallBack
()
{
@Override
@Override
...
@@ -879,13 +889,15 @@ public class SobotLoginTools {
...
@@ -879,13 +889,15 @@ public class SobotLoginTools {
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_SUCCEEDED
,
"登录成功"
,
tempServiceInfoModel
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_SUCCEEDED
,
"登录成功"
,
tempServiceInfoModel
);
}
}
}
else
{
}
else
{
SobotLogUtils
.
i
(
"appLogin 接口返回code不等于1:"
+
result
);
if
(
resultBlock
!=
null
)
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
FAILED
,
baseModel
.
getMsg
(),
baseModel
.
getCode
()
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
SUCCEEDED
,
"登录成功"
,
infoModel
);
}
}
}
}
}
else
{
}
else
{
SobotLogUtils
.
i
(
"appLogin 接口请求结果为空"
);
if
(
resultBlock
!=
null
)
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
FAILED
,
"appLogin 接口请求结果为空,登录失败"
,
nul
l
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
SUCCEEDED
,
"登录成功"
,
infoMode
l
);
}
}
}
}
}
}
...
@@ -893,8 +905,9 @@ public class SobotLoginTools {
...
@@ -893,8 +905,9 @@ public class SobotLoginTools {
@Override
@Override
public
void
onError
(
Exception
e
,
String
msg
,
int
responseCode
)
{
public
void
onError
(
Exception
e
,
String
msg
,
int
responseCode
)
{
SobotLogUtils
.
i
(
SobotStringUtils
.
checkStringIsNull
(
msg
));
if
(
resultBlock
!=
null
)
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
FAILED
,
msg
,
nul
l
);
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_
SUCCEEDED
,
"登录成功"
,
infoMode
l
);
}
}
}
}
...
@@ -904,7 +917,9 @@ public class SobotLoginTools {
...
@@ -904,7 +917,9 @@ public class SobotLoginTools {
}
}
});
});
}
else
{
}
else
{
if
(
resultBlock
!=
null
)
{
resultBlock
.
resultBolok
(
SobotResultCode
.
CODE_SUCCEEDED
,
"登录成功"
,
infoModel
);
}
}
}
}
}
...
...
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