diff --git a/common/service-utils/pom.xml b/common/service-utils/pom.xml index a8cb4d0..32bafae 100644 --- a/common/service-utils/pom.xml +++ b/common/service-utils/pom.xml @@ -59,5 +59,11 @@ com.github.pagehelper pagehelper + + + org.lionsoul + ip2region + 2.6.5 + diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/utils/CommentUtil.java b/common/service-utils/src/main/java/cn/bunny/common/service/utils/CommentUtil.java deleted file mode 100644 index 0ebe210..0000000 --- a/common/service-utils/src/main/java/cn/bunny/common/service/utils/CommentUtil.java +++ /dev/null @@ -1,51 +0,0 @@ -package cn.bunny.common.service.utils; - -import cn.bunny.vo.user.comment.CommentVo; - -import java.util.ArrayList; -import java.util.List; - -public class CommentUtil { - /** - * 构建树型结构 - * - * @param commentList 评论列表 - * @return 结构列表 - */ - public static List buildTree(List commentList) { - // 构建树形结构 - List tree = new ArrayList<>(); - // 遍历评论列表 - for (CommentVo comment : commentList) { - // 找到顶级评论(没有父评论) - if (comment.getPCommentId() == 0) { - // 递归构建子评论 - comment.setChildren(getChildren(comment.getId(), commentList)); - tree.add(comment); - } - } - return tree; - } - - /** - * 递归获取子评论 - * - * @param commentId 当前评论ID - * @param commentList 评论列表 - * @return 子评论列表 - */ - private static List getChildren(Long commentId, List commentList) { - List children = new ArrayList<>(); - - // 遍历评论列表 - for (CommentVo comment : commentList) { - // 找到当前评论的子评论 - if (Long.valueOf(comment.getPCommentId()).equals(commentId)) { - // 递归构建子评论的子评论 - comment.setChildren(getChildren(comment.getId(), commentList)); - children.add(comment); - } - } - return children; - } -} diff --git a/service/src/main/resources/ipdb/ip2region.xdb b/service/src/main/resources/ipdb/ip2region.xdb new file mode 100644 index 0000000..7052c05 Binary files /dev/null and b/service/src/main/resources/ipdb/ip2region.xdb differ diff --git a/service/src/main/resources/templates/email-template.html b/service/src/main/resources/templates/email-template.html new file mode 100644 index 0000000..b2b89b4 --- /dev/null +++ b/service/src/main/resources/templates/email-template.html @@ -0,0 +1,45 @@ + +
+ + + + + + + + + + +
+

BunnyBBS邮箱验证码

+
+
+

+ 尊敬的用户, +

+

+ 感谢您注册我们的产品. 您的账号正在进行电子邮件验证. +

+

+ 验证码为: ${verifyCode} +

+

+ 验证码的有效期只有一分钟,请抓紧时间进行验证吧! +

+

+ 如果非本人操作,请忽略此邮件 +

+
+
+

+ XXXXX
+ Contact us: XXXXXXX@qq.com +

+

+ This is an automated email, please do not reply.
+ © Company Name +

+
+
+ \ No newline at end of file diff --git a/service/src/test/java/cn/bunny/ipdb/IpDbTest.java b/service/src/test/java/cn/bunny/ipdb/IpDbTest.java new file mode 100644 index 0000000..97f1016 --- /dev/null +++ b/service/src/test/java/cn/bunny/ipdb/IpDbTest.java @@ -0,0 +1,16 @@ +package cn.bunny.ipdb; + +import cn.bunny.common.service.utils.IpUtil; +import org.junit.jupiter.api.Test; + +public class IpDbTest { + @Test + public void test() { + String ip = "220.248.12.158"; // IpRegion:上海 +// String ip = "47.52.236.180"; // IpRegion:香港 +// String ip = "172.22.12.123"; // IpRegion:内网IP +// String ip = "164.114.53.60"; // IpRegion:美国 + String ipRegion = IpUtil.getIpRegion(ip); + System.out.println(ipRegion); + } +}