Commit 27982752 authored by 黎博's avatar 黎博

Merge branch 'master' into monitor

parents bd87532d 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));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment