Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
68f7171a
Commit
68f7171a
authored
Nov 24, 2017
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
简化版
parent
08f2d3ae
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
6 deletions
+17
-6
UserController.java
...ntgroup/xyqb/controller/internal/user/UserController.java
+4
-1
ValidationUtil.java
src/main/java/cn/quantgroup/xyqb/util/ValidationUtil.java
+1
-5
TestValidUtil.java
src/test/java/user/TestValidUtil.java
+12
-0
No files found.
src/main/java/cn/quantgroup/xyqb/controller/internal/user/UserController.java
View file @
68f7171a
...
@@ -100,7 +100,10 @@ public class UserController implements IBaseController {
...
@@ -100,7 +100,10 @@ public class UserController implements IBaseController {
}
}
// 操作标记
// 操作标记
boolean
lock
=
Objects
.
equals
(
Boolean
.
TRUE
.
toString
(),
act
);
boolean
lock
=
Objects
.
equals
(
Boolean
.
TRUE
.
toString
(),
act
);
boolean
valid
=
ValidationUtil
.
isValid
(
key
,
lock
);
Calendar
now
=
Calendar
.
getInstance
();
int
hour
=
now
.
get
(
Calendar
.
HOUR_OF_DAY
);
boolean
valid
=
Objects
.
equals
(
Constants
.
CLEAR_LOCK_FOR_IPV4_KEY
+
hour
,
key
);
// Todo -- boolean valid = ValidationUtil.isValid(key, lock);
if
(
valid
){
if
(
valid
){
String
lockIpv4Key
=
getLockIpv4Key
(
ip
);
String
lockIpv4Key
=
getLockIpv4Key
(
ip
);
if
(
lock
){
if
(
lock
){
...
...
src/main/java/cn/quantgroup/xyqb/util/ValidationUtil.java
View file @
68f7171a
...
@@ -66,11 +66,7 @@ public class ValidationUtil {
...
@@ -66,11 +66,7 @@ public class ValidationUtil {
* @return
* @return
*/
*/
public
static
boolean
isValid
(
String
key
,
boolean
lock
)
{
public
static
boolean
isValid
(
String
key
,
boolean
lock
)
{
Calendar
today
=
Calendar
.
getInstance
();
return
Objects
.
equals
(
key
,
getMd5Key
(
key
,
lock
));
int
hour_24
=
today
.
get
(
Calendar
.
HOUR_OF_DAY
);
StringBuilder
_key
=
new
StringBuilder
();
_key
.
append
(
Constants
.
CLEAR_LOCK_FOR_IPV4_KEY
).
append
(
lock
).
append
(
hour_24
);
return
Objects
.
equals
(
key
,
MD5Util
.
build
(
_key
.
toString
()));
}
}
/**
/**
...
...
src/test/java/user/TestValidUtil.java
0 → 100644
View file @
68f7171a
package
user
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
public
class
TestValidUtil
{
public
static
void
main
(
String
[]
args
)
{
String
key
=
ValidationUtil
.
getMd5Key
(
"123"
,
true
);
System
.
out
.
println
(
key
);
}
}
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