Commit f39482be by zhengnw@sobot.com

common 1.5.8 添加 sdk 退出登录2

parent 19493fba
......@@ -153,8 +153,8 @@ public class SobotLoginTools {
public boolean checkExpiresToken() {
if (getLoginUser() != null) {
long difference = System.currentTimeMillis() - getLoginUser().getLogin_time();
SobotLogUtils.d("检查token是否过期:上次登录距离当前的时间" + difference);
if (getLoginUser().getLogin_time() > 0 && (difference > 12 * 60 * 60 * 1000)) {
SobotLogUtils.d("上次登录距离当前的时间:" + difference + "ms,已经超过12小时,token已经过期");
return false;
}
}
......@@ -458,10 +458,13 @@ public class SobotLoginTools {
// sdk 执行退出登录
public void logOut(Object cancelTag, String host, String loginAcount, final SobotResultBlock resultBlock) {
if (SobotStringUtils.isEmpty(loginAcount)) {
if (!SobotStringUtils.isEmpty(loginAcount) && isLogin(loginAcount)) {
Map<String, Object> params = new HashMap<>();
params.put("loginUser", loginAcount);
SobotHttpUtils.doPost(cancelTag, host + "/basic-login/serviceLogOut/4", 8000, params, null, new HttpBaseUtils.StringCallBack() {
Map<String, String> headerParams = new HashMap<>();
headerParams.put("temp-id", getToken());
headerParams.put("from", 2 + "");
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment