Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
legobackend
/
lego-manage
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
b397102b
authored
2025-08-08 00:10:27 +0800
by
chentao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
no message
1 parent
06266bf1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
17 deletions
lego-admin/src/main/java/com/lego/web/controller/core/UpgradeController.java
lego-framework/src/main/java/com/lego/framework/config/SaTokenConfig.java
lego-admin/src/main/java/com/lego/web/controller/core/UpgradeController.java
View file @
b397102
package
com
.
lego
.
web
.
controller
.
core
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.lego.common.annotation.RepeatSubmit
;
import
com.lego.common.core.controller.BaseController
;
import
com.lego.common.core.domain.R
;
import
com.lego.common.core.page.TableDataInfo
;
import
com.lego.common.utils.EncryptUtils
;
import
com.lego.common.utils.MessageUtils
;
import
com.lego.core.domin.bo.UpgradeBo
;
import
com.lego.core.domin.bo.UpgradeQueryBo
;
import
com.lego.core.domin.vo.ResourceVo
;
...
...
@@ -40,8 +43,16 @@ public class UpgradeController extends BaseController {
}
@GetMapping
(
"/list"
)
public
R
<
ResourceVo
>
list
()
{
return
R
.
ok
(
service
.
list
());
public
R
<
String
>
list
()
{
try
{
ResourceVo
resourceVo
=
service
.
list
();
ObjectMapper
objectMapper
=
new
ObjectMapper
();
String
json
=
objectMapper
.
writeValueAsString
(
resourceVo
);
return
R
.
ok
(
MessageUtils
.
message
(
"system.success"
),
EncryptUtils
.
encryptByAes
(
json
));
}
catch
(
Exception
e
){
return
R
.
fail
();
}
}
/**
...
...
lego-framework/src/main/java/com/lego/framework/config/SaTokenConfig.java
View file @
b397102
...
...
@@ -58,31 +58,21 @@ public class SaTokenConfig implements WebMvcConfigurer {
.
check
(()
->
{
// 检查是否登录 是否有token
SaRequest
request
=
SaHolder
.
getRequest
();
String
version
=
request
.
getHeader
(
"version"
);
System
.
out
.
println
(
"versioncode:"
+
version
);
if
(
StringUtils
.
isNotBlank
(
version
))
{
String
token
=
request
.
getHeader
(
"token"
);
System
.
out
.
println
(
"token:"
+
token
);
SaTokenDao
plusSaTokenDao
=
saTokenDao
();
String
secret
=
CacheUtils
.
get
(
CacheNames
.
VERSION_CODE
,
version
);
System
.
out
.
println
(
"secret:"
+
secret
);
String
appSecret
=
EncryptUtils
.
decryptByAes
(
secret
);
System
.
out
.
println
(
"appSecret"
+
appSecret
);
String
explicitToken
=
EncryptUtils
.
decryptByAes
(
token
,
appSecret
);
System
.
out
.
println
(
"explicitToken"
+
explicitToken
);
List
<
String
>
list
=
Arrays
.
asList
(
explicitToken
.
split
(
"&"
));
if
(!
CollectionUtils
.
isEmpty
(
list
)){
if
(
StringUtils
.
isNotBlank
(
token
))
{
String
timestamp
=
EncryptUtils
.
decryptByAes
(
token
);
System
.
out
.
println
(
"timestamp:"
+
timestamp
);
long
time
=
System
.
currentTimeMillis
();
long
period
=
time
-
Long
.
valueOf
(
list
.
get
(
0
)
);
long
period
=
time
-
Long
.
valueOf
(
timestamp
);
System
.
out
.
println
(
"period:"
+
period
);
if
(
period
<
60000
&&
period
>
0
){
if
(
period
<=
60000
&&
period
>=
0
){
}
else
{
throw
NotLoginException
.
newInstance
(
""
,
"-2"
,
"token 无效"
,
token
).
setCode
(
403
);
}
}
}
else
{
StpUtil
.
checkLogin
();
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment