From e618f8e404bc7668b0f16c882133240ccdcd9753 Mon Sep 17 00:00:00 2001 From: Chasel Date: Tue, 21 Mar 2023 14:25:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?https://gitee.com/zhijiantianya/yudao-cloud?= =?UTF-8?q?/issues/I6KP0U=20=E4=BF=AE=E5=A4=8Dip=E7=A9=BA=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2=E5=BC=95=E8=B5=B7=E7=9A=84=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/system/controller/admin/ip/AreaController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ip/AreaController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ip/AreaController.java index 25b7cfba2..c9db25234 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ip/AreaController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ip/AreaController.java @@ -39,7 +39,7 @@ public class AreaController { @Parameter(name = "ip", description = "IP", required = true) public CommonResult getAreaByIp(@RequestParam("ip") String ip) { // 获得城市 - Area area = IPUtils.getArea(ip); + Area area = IPUtils.getArea(ip.trim()); if (area == null) { return success("未知"); } From cdc52f32ea45f80f5780ed84ecb8243d5542b74a Mon Sep 17 00:00:00 2001 From: Chasel Date: Thu, 30 Mar 2023 14:42:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?https://gitee.com/zhijiantianya/yudao-cloud?= =?UTF-8?q?/issues/I6KP0U=20=E5=9C=A8IpUtils=E9=87=8C=E4=BF=AE=E5=A4=8Dip?= =?UTF-8?q?=E7=A9=BA=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=BC=95=E8=B5=B7=E7=9A=84?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/iocoder/yudao/framework/ip/core/utils/IPUtils.java | 2 +- .../yudao/module/system/controller/admin/ip/AreaController.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-biz-ip/src/main/java/cn/iocoder/yudao/framework/ip/core/utils/IPUtils.java b/yudao-framework/yudao-spring-boot-starter-biz-ip/src/main/java/cn/iocoder/yudao/framework/ip/core/utils/IPUtils.java index 8ad794637..f74f84864 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-ip/src/main/java/cn/iocoder/yudao/framework/ip/core/utils/IPUtils.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-ip/src/main/java/cn/iocoder/yudao/framework/ip/core/utils/IPUtils.java @@ -51,7 +51,7 @@ public class IPUtils { */ @SneakyThrows public static Integer getAreaId(String ip) { - return Integer.parseInt(SEARCHER.search(ip)); + return Integer.parseInt(SEARCHER.search(ip.trim())); } /** diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ip/AreaController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ip/AreaController.java index c9db25234..25b7cfba2 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ip/AreaController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ip/AreaController.java @@ -39,7 +39,7 @@ public class AreaController { @Parameter(name = "ip", description = "IP", required = true) public CommonResult getAreaByIp(@RequestParam("ip") String ip) { // 获得城市 - Area area = IPUtils.getArea(ip.trim()); + Area area = IPUtils.getArea(ip); if (area == null) { return success("未知"); }