Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
39f4b239
Commit
39f4b239
authored
May 13, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加对Android的支持
parent
93fd97cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
7 deletions
+21
-7
TokenData.java
...til-db/src/main/java/com/yanzuoguang/token/TokenData.java
+13
-0
TokenHelper.java
...l-db/src/main/java/com/yanzuoguang/token/TokenHelper.java
+8
-7
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/token/TokenData.java
View file @
39f4b239
...
...
@@ -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
;
}
}
yzg-util-db/src/main/java/com/yanzuoguang/token/TokenHelper.java
View file @
39f4b239
...
...
@@ -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
;
}
...
...
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