Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
Project
Project
Details
Activity
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
liyang
sts网站
Commits
f5badba2
Commit
f5badba2
authored
Jun 19, 2020
by
Sxile
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加{}使代码更容易理解
parent
9ea0041f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
VerifyCodeUtils.java
...src/main/java/com/ruoyi/common/utils/VerifyCodeUtils.java
+4
-2
IpUtils.java
ruoyi/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java
+12
-6
No files found.
ruoyi/src/main/java/com/ruoyi/common/utils/VerifyCodeUtils.java
View file @
f5badba2
...
@@ -139,10 +139,12 @@ public class VerifyCodeUtils
...
@@ -139,10 +139,12 @@ public class VerifyCodeUtils
private
static
Color
getRandColor
(
int
fc
,
int
bc
)
private
static
Color
getRandColor
(
int
fc
,
int
bc
)
{
{
if
(
fc
>
255
)
if
(
fc
>
255
)
{
fc
=
255
;
fc
=
255
;
if
(
bc
>
255
)
}
if
(
bc
>
255
)
{
bc
=
255
;
bc
=
255
;
}
int
r
=
fc
+
random
.
nextInt
(
bc
-
fc
);
int
r
=
fc
+
random
.
nextInt
(
bc
-
fc
);
int
g
=
fc
+
random
.
nextInt
(
bc
-
fc
);
int
g
=
fc
+
random
.
nextInt
(
bc
-
fc
);
int
b
=
fc
+
random
.
nextInt
(
bc
-
fc
);
int
b
=
fc
+
random
.
nextInt
(
bc
-
fc
);
...
...
ruoyi/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java
View file @
f5badba2
...
@@ -110,8 +110,9 @@ public class IpUtils
...
@@ -110,8 +110,9 @@ public class IpUtils
{
{
case
1
:
case
1
:
l
=
Long
.
parseLong
(
elements
[
0
]);
l
=
Long
.
parseLong
(
elements
[
0
]);
if
((
l
<
0L
)
||
(
l
>
4294967295L
))
if
((
l
<
0L
)
||
(
l
>
4294967295L
))
{
return
null
;
return
null
;
}
bytes
[
0
]
=
(
byte
)
(
int
)
(
l
>>
24
&
0xFF
);
bytes
[
0
]
=
(
byte
)
(
int
)
(
l
>>
24
&
0xFF
);
bytes
[
1
]
=
(
byte
)
(
int
)
((
l
&
0xFFFFFF
)
>>
16
&
0xFF
);
bytes
[
1
]
=
(
byte
)
(
int
)
((
l
&
0xFFFFFF
)
>>
16
&
0xFF
);
bytes
[
2
]
=
(
byte
)
(
int
)
((
l
&
0xFFFF
)
>>
8
&
0xFF
);
bytes
[
2
]
=
(
byte
)
(
int
)
((
l
&
0xFFFF
)
>>
8
&
0xFF
);
...
@@ -119,12 +120,14 @@ public class IpUtils
...
@@ -119,12 +120,14 @@ public class IpUtils
break
;
break
;
case
2
:
case
2
:
l
=
Integer
.
parseInt
(
elements
[
0
]);
l
=
Integer
.
parseInt
(
elements
[
0
]);
if
((
l
<
0L
)
||
(
l
>
255L
))
if
((
l
<
0L
)
||
(
l
>
255L
))
{
return
null
;
return
null
;
}
bytes
[
0
]
=
(
byte
)
(
int
)
(
l
&
0xFF
);
bytes
[
0
]
=
(
byte
)
(
int
)
(
l
&
0xFF
);
l
=
Integer
.
parseInt
(
elements
[
1
]);
l
=
Integer
.
parseInt
(
elements
[
1
]);
if
((
l
<
0L
)
||
(
l
>
16777215L
))
if
((
l
<
0L
)
||
(
l
>
16777215L
))
{
return
null
;
return
null
;
}
bytes
[
1
]
=
(
byte
)
(
int
)
(
l
>>
16
&
0xFF
);
bytes
[
1
]
=
(
byte
)
(
int
)
(
l
>>
16
&
0xFF
);
bytes
[
2
]
=
(
byte
)
(
int
)
((
l
&
0xFFFF
)
>>
8
&
0xFF
);
bytes
[
2
]
=
(
byte
)
(
int
)
((
l
&
0xFFFF
)
>>
8
&
0xFF
);
bytes
[
3
]
=
(
byte
)
(
int
)
(
l
&
0xFF
);
bytes
[
3
]
=
(
byte
)
(
int
)
(
l
&
0xFF
);
...
@@ -133,13 +136,15 @@ public class IpUtils
...
@@ -133,13 +136,15 @@ public class IpUtils
for
(
i
=
0
;
i
<
2
;
++
i
)
for
(
i
=
0
;
i
<
2
;
++
i
)
{
{
l
=
Integer
.
parseInt
(
elements
[
i
]);
l
=
Integer
.
parseInt
(
elements
[
i
]);
if
((
l
<
0L
)
||
(
l
>
255L
))
if
((
l
<
0L
)
||
(
l
>
255L
))
{
return
null
;
return
null
;
}
bytes
[
i
]
=
(
byte
)
(
int
)
(
l
&
0xFF
);
bytes
[
i
]
=
(
byte
)
(
int
)
(
l
&
0xFF
);
}
}
l
=
Integer
.
parseInt
(
elements
[
2
]);
l
=
Integer
.
parseInt
(
elements
[
2
]);
if
((
l
<
0L
)
||
(
l
>
65535L
))
if
((
l
<
0L
)
||
(
l
>
65535L
))
{
return
null
;
return
null
;
}
bytes
[
2
]
=
(
byte
)
(
int
)
(
l
>>
8
&
0xFF
);
bytes
[
2
]
=
(
byte
)
(
int
)
(
l
>>
8
&
0xFF
);
bytes
[
3
]
=
(
byte
)
(
int
)
(
l
&
0xFF
);
bytes
[
3
]
=
(
byte
)
(
int
)
(
l
&
0xFF
);
break
;
break
;
...
@@ -147,8 +152,9 @@ public class IpUtils
...
@@ -147,8 +152,9 @@ public class IpUtils
for
(
i
=
0
;
i
<
4
;
++
i
)
for
(
i
=
0
;
i
<
4
;
++
i
)
{
{
l
=
Integer
.
parseInt
(
elements
[
i
]);
l
=
Integer
.
parseInt
(
elements
[
i
]);
if
((
l
<
0L
)
||
(
l
>
255L
))
if
((
l
<
0L
)
||
(
l
>
255L
))
{
return
null
;
return
null
;
}
bytes
[
i
]
=
(
byte
)
(
int
)
(
l
&
0xFF
);
bytes
[
i
]
=
(
byte
)
(
int
)
(
l
&
0xFF
);
}
}
break
;
break
;
...
...
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