From 2ddbd99aa5b2e396f96c6daba60fe1ac2573d9fb Mon Sep 17 00:00:00 2001
From: inleft <inleft@qq.com>
Date: Sat, 18 May 2024 11:53:54 +0800
Subject: [PATCH] 新增RSS 订阅链接

---
 snowy-main/src/main/java/vip/xiaonuo/modular/blogfriendshiplink/controller/BlogLinkOutsideController.java |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/blogfriendshiplink/controller/BlogLinkOutsideController.java b/snowy-main/src/main/java/vip/xiaonuo/modular/blogfriendshiplink/controller/BlogLinkOutsideController.java
index 9961473..1e07422 100644
--- a/snowy-main/src/main/java/vip/xiaonuo/modular/blogfriendshiplink/controller/BlogLinkOutsideController.java
+++ b/snowy-main/src/main/java/vip/xiaonuo/modular/blogfriendshiplink/controller/BlogLinkOutsideController.java
@@ -32,6 +32,7 @@
 import vip.xiaonuo.core.consts.CommonConstant;
 import vip.xiaonuo.core.consts.MyConstant;
 import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum;
+import vip.xiaonuo.core.exception.BlogException;
 import vip.xiaonuo.core.pojo.response.ResponseData;
 import vip.xiaonuo.core.pojo.response.SuccessResponseData;
 import vip.xiaonuo.modular.blogfriendshiplink.entity.BlogFriendshipLink;
@@ -121,6 +122,13 @@
     @PostMapping("/blogLink/add")
     @BusinessLog(title = "外部blog系统_blog友情链接_增加", opType = LogAnnotionOpTypeEnum.ADD)
     public ResponseData add(@RequestBody @Validated(BlogFriendshipLinkParam.add.class) BlogFriendshipLinkParam blogFriendshipLinkParam) {
+
+        if (blogFriendshipLinkService.lambdaQuery()
+                .eq(BlogFriendshipLink::getUrl, blogFriendshipLinkParam.getUrl())
+                .count() > 0) {
+            throw new BlogException("已经有该链接的记录啦,不要重复提交哦..");
+        }
+
         blogFriendshipLinkParam.setIsEnable(MyConstant.Yes);
         blogFriendshipLinkService.add(blogFriendshipLinkParam);
         return new SuccessResponseData();

--
Gitblit v1.9.1