From 31929207a91ad4d215f11401b17446cf09eefd2c Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期一, 17 三月 2025 17:36:21 +0800 Subject: [PATCH] 添加用户手机号码的校验 --- UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FeedbackServiceImpl.java | 16 +++------------- 1 files changed, 3 insertions(+), 13 deletions(-) diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FeedbackServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FeedbackServiceImpl.java index 91b6c5f..055d0c8 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FeedbackServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FeedbackServiceImpl.java @@ -68,21 +68,11 @@ language = userInfoService.queryLanguage(uid, language); return ResultUtil.error(language == 1 ? "反馈内容过长" : language == 2 ? "Feedback-content is overlong." : "Le contenu de l’avis est trop long."); } + content = content.toLowerCase(); List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null); - List<String> list = Arrays.asList(content.split(" ")); - for(SensitiveWords s : sensitiveWords){ - List<String> str = new ArrayList<>(); - String lowerCase = s.getContent().toLowerCase(); - for (String s1 : list) { - if(lowerCase.equals(s1.toLowerCase())){ - str.add("***"); - }else{ - str.add(s1); - } - } - list = str; + for(SensitiveWords s : sensitiveWords) { + content = content.replaceAll(s.getContent().toLowerCase(), "***"); } - content = list.stream().collect(Collectors.joining(" ")); } Feedback feedback = new Feedback(); -- Gitblit v1.7.1