Commit f39482be by zhengnw@sobot.com

common 1.5.8 添加 sdk 退出登录2

parent 19493fba
...@@ -153,8 +153,8 @@ public class SobotLoginTools { ...@@ -153,8 +153,8 @@ public class SobotLoginTools {
public boolean checkExpiresToken() { public boolean checkExpiresToken() {
if (getLoginUser() != null) { if (getLoginUser() != null) {
long difference = System.currentTimeMillis() - getLoginUser().getLogin_time(); long difference = System.currentTimeMillis() - getLoginUser().getLogin_time();
SobotLogUtils.d("检查token是否过期:上次登录距离当前的时间" + difference);
if (getLoginUser().getLogin_time() > 0 && (difference > 12 * 60 * 60 * 1000)) { if (getLoginUser().getLogin_time() > 0 && (difference > 12 * 60 * 60 * 1000)) {
SobotLogUtils.d("上次登录距离当前的时间:" + difference + "ms,已经超过12小时,token已经过期");
return false; return false;
} }
} }
...@@ -458,10 +458,13 @@ public class SobotLoginTools { ...@@ -458,10 +458,13 @@ 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)) { if (!SobotStringUtils.isEmpty(loginAcount) && isLogin(loginAcount)) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("loginUser", loginAcount); 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 @Override
public void onResponse(String response) { public void onResponse(String response) {
SobotCallBaseCode result = SobotGsonUtil.jsonToBean(response, SobotCallBaseCode.class); 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