Commit 39f4b239 authored by yanzg's avatar yanzg

添加对Android的支持

parent 93fd97cc
......@@ -29,6 +29,11 @@ public class TokenData {
*/
private MapRow data = new MapRow();
/**
* 是否写入到数据库
*/
private boolean write = false;
public TokenData() {
}
......@@ -70,4 +75,12 @@ public class TokenData {
public void setData(MapRow data) {
this.data = data;
}
public boolean isWrite() {
return write;
}
public void setWrite(boolean write) {
this.write = write;
}
}
......@@ -137,8 +137,8 @@ public class TokenHelper {
* @param token 标记
* @param data 数据时间
*/
public static TokenData write(String token, Object data) {
return write(token, StringHelper.EMPTY, 0, data);
public static void write(String token, Object data) {
write(token, StringHelper.EMPTY, 0, data);
}
/**
......@@ -148,8 +148,8 @@ public class TokenHelper {
* @param expire 有效期
* @param data 数据时间
*/
public static TokenData write(String token, long expire, Object data) {
return write(token, StringHelper.EMPTY, expire, data);
public static void write(String token, long expire, Object data) {
write(token, StringHelper.EMPTY, expire, data);
}
......@@ -161,7 +161,7 @@ public class TokenHelper {
* @param dataPwd 数据密码
* @param data 数据时间
*/
public static TokenData write(String token, String dataPwd, long expire, Object data) {
public static void write(String token, String dataPwd, long expire, Object data) {
String id = getCurrentId();
TokenData tokenData = cache.get(id);
if (tokenData == null) {
......@@ -177,11 +177,11 @@ public class TokenHelper {
tokenData.setData(new MapRow());
}
ObjectHelper.writeWithFrom(tokenData.getData(), data);
return tokenData;
tokenData.setWrite(true);
}
/**
* 设置登录标记字符串
* 设置登录标记字符串(用于初始化设置,本次修改不会写入到数据库)
*
* @param tokenString 登录标记字符串
*/
......@@ -189,6 +189,7 @@ public class TokenHelper {
String id = getCurrentId();
TokenData tokenData = JsonHelper.deserialize(tokenString, TokenData.class);
cache.put(id, tokenData);
tokenData.setWrite(false);
return tokenData;
}
......
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