Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
holmes
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
QA
holmes
Commits
065915ed
Commit
065915ed
authored
Dec 30, 2021
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化下清除缓存接口
parent
64e32721
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
EffectController.java
...java/cn/qg/holmes/controller/effect/EffectController.java
+9
-3
No files found.
src/main/java/cn/qg/holmes/controller/effect/EffectController.java
View file @
065915ed
...
...
@@ -6,6 +6,7 @@ import cn.qg.holmes.service.effect.ClearCacheService;
import
cn.qg.holmes.utils.HttpClientUtils
;
import
com.alibaba.fastjson.JSON
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -41,10 +42,15 @@ public class EffectController {
@GetMapping
(
"/clearcache"
)
public
JsonResult
clearCache
(
Integer
id
,
String
namespace
)
{
ClearCache
clearCache
=
clearCacheService
.
getById
(
id
);
log
.
info
(
"开始清除{}环境的{}缓存"
,
namespace
,
clearCache
.
getName
());
String
url
=
clearCache
.
getUrl
();
String
result
=
HttpClientUtils
.
doGet
(
url
.
replace
(
"{NAMESPACE}"
,
namespace
));
log
.
info
(
"{}环境的{}缓存清除结果为:{}"
,
namespace
,
clearCache
.
getName
(),
result
);
if
(
url
.
contains
(
"{NAMESPACE}"
))
{
if
(
StringUtils
.
isEmpty
(
namespace
))
{
return
JsonResult
.
buildErrorStateResult
(
"请先选择环境!"
,
false
);
}
else
{
url
=
url
.
replace
(
"{NAMESPACE}"
,
namespace
);
}
}
String
result
=
HttpClientUtils
.
doGet
(
url
);
return
JsonResult
.
buildSuccessResult
(
JSON
.
parseObject
(
result
,
Map
.
class
));
}
}
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