From 28e5a386ba8b115cd32ce81be640dcd6d92b93c5 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 9 Feb 2023 16:15:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hai/common/utils/BaiduUtils.java | 11 ++++++++--- .../impl/HighDiscountAgentCodeServiceImpl.java | 2 +- .../com/hai/service/impl/HighUserServiceImpl.java | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/hai-service/src/main/java/com/hai/common/utils/BaiduUtils.java b/hai-service/src/main/java/com/hai/common/utils/BaiduUtils.java index 7f8d8fb0..92bcfe42 100644 --- a/hai-service/src/main/java/com/hai/common/utils/BaiduUtils.java +++ b/hai-service/src/main/java/com/hai/common/utils/BaiduUtils.java @@ -21,9 +21,14 @@ public class BaiduUtils { * @return */ public static JSONObject ipLocation(String ip) { - JSONObject response = HttpsUtils.doGet("https://api.map.baidu.com/location/ip?ak=X4sSdXsohVOMb1tNiLZloD9ows5FaNjq&ip=" + ip); - log.info(response.toJSONString()); - return response; + if (ip != null) { + JSONObject response = HttpsUtils.doGet("https://api.map.baidu.com/location/ip?ak=X4sSdXsohVOMb1tNiLZloD9ows5FaNjq&ip=" + ip); + log.info(response.toJSONString()); + return response; + + } else { + return null; + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java index 69c01860..c3918ae1 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java @@ -267,7 +267,7 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe useDiscount(discountAgentCodeId); } } catch (Exception e) { - + throw e; } finally { // 删除key,释放锁 redisTemplate.delete(key); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java index eaabdb3c..d89f2fdf 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java @@ -84,6 +84,7 @@ public class HighUserServiceImpl implements HighUserService { public SessionObject loginAndRegister(LoginPlatform platform,String phone, Long popularizeUserId, Map other,HttpServletRequest request, HttpServletResponse response) throws Exception { // 记录登录信息 String requestIp = RequestUtils.getRequestIp(); + System.out.println(requestIp); HighUserLoginLog loginLog = new HighUserLoginLog(); loginLog.setUserPhone(phone); loginLog.setPlatformCode(platform.getCode());