From 59f70d9b19408d36f40ee0f418bf98232c40fb33 Mon Sep 17 00:00:00 2001 From: yanghb <yanghb> Date: 星期五, 21 四月 2023 09:41:42 +0800 Subject: [PATCH] 代码调整 --- DispatchTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/RedisUtil.java | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/DispatchTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/RedisUtil.java b/DispatchTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/RedisUtil.java index c4ff6fc..533a93d 100644 --- a/DispatchTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/RedisUtil.java +++ b/DispatchTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/RedisUtil.java @@ -22,7 +22,6 @@ @Autowired private RestTemplate internalRestTemplate; - private final String host = "http://ZUUL-GATEWAY/"; /** * 向redis中存储字符串没有过期时间 @@ -40,7 +39,7 @@ params.add("key", key); params.add("value", value); HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); - String s = internalRestTemplate.postForObject(host + "/redis/setValue_", requestEntity, String.class); + String s = internalRestTemplate.postForObject("http://zuul-gateway/redis/setValue_", requestEntity, String.class); JSONObject jsonObject = JSON.parseObject(s, JSONObject.class); if(jsonObject.getIntValue("code") != 200){ System.err.println("调用redis出错了"); @@ -68,7 +67,7 @@ params.add("value", value); params.add("time", String.valueOf(time)); HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers); - String s = internalRestTemplate.postForObject(host+"/redis/setValue", requestEntity, String.class); + String s = internalRestTemplate.postForObject("http://zuul-gateway/redis/setValue", requestEntity, String.class); JSONObject jsonObject = JSON.parseObject(s, JSONObject.class); if(jsonObject.getIntValue("code") != 200){ System.err.println("调用redis出错了"); @@ -91,7 +90,7 @@ MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); params.add("key", key); HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); - String s = internalRestTemplate.postForObject(host + "/redis/getValue",requestEntity , String.class); + String s = internalRestTemplate.postForObject("http://zuul-gateway/redis/getValue",requestEntity , String.class); JSONObject jsonObject = JSON.parseObject(s, JSONObject.class); if(jsonObject.getIntValue("code") != 200){ System.err.println("调用redis出错了"); @@ -115,7 +114,7 @@ MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); params.add("key", key); HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); - String s = internalRestTemplate.postForObject(host + "/redis/remove",requestEntity , String.class); + String s = internalRestTemplate.postForObject("http://zuul-gateway/redis/remove",requestEntity , String.class); JSONObject jsonObject = JSON.parseObject(s, JSONObject.class); if(jsonObject.getIntValue("code") != 200){ System.err.println("调用redis出错了"); -- Gitblit v1.7.1