From 50ce1bb6db439616d406a898c9915028def103af Mon Sep 17 00:00:00 2001 From: zhaojun1998 Date: Wed, 10 Mar 2021 21:41:14 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E4=BF=AE=E6=94=B9=E7=9B=B4?= =?UTF-8?q?=E9=93=BE=20Key=20=E6=97=B6=E6=A3=80=E6=B5=8B=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zhaojun/zfile/controller/home/ShortLinkController.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/im/zhaojun/zfile/controller/home/ShortLinkController.java b/src/main/java/im/zhaojun/zfile/controller/home/ShortLinkController.java index 51bd7b9..53d75d0 100644 --- a/src/main/java/im/zhaojun/zfile/controller/home/ShortLinkController.java +++ b/src/main/java/im/zhaojun/zfile/controller/home/ShortLinkController.java @@ -74,10 +74,14 @@ public class ShortLinkController { } - @GetMapping("admin/api/short-link/key") @ResponseBody public ResultBean updateShortKey(Integer id, String newKey) { + ShortLinkConfig newShortLinkConfig = shortLinkConfigService.findByKey(newKey); + if (newShortLinkConfig != null) { + throw new RuntimeException("您输入的 Key 已存在,请重新输入"); + } + ShortLinkConfig shortLinkConfig = shortLinkConfigService.findById(id); if (shortLinkConfig == null) { throw new RuntimeException("此直链不存在或已失效.");