From 211cdc9838a972de7d09a6c96b2d3d6d392bf8db Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Sun, 6 Sep 2026 21:57:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Spug=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/MessageHubClientServiceImpl.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/integration/service/impl/MessageHubClientServiceImpl.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/integration/service/impl/MessageHubClientServiceImpl.java index 9ea54e23..3a401a35 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/integration/service/impl/MessageHubClientServiceImpl.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/integration/service/impl/MessageHubClientServiceImpl.java @@ -228,7 +228,7 @@ public class MessageHubClientServiceImpl implements MessageHubClientService { } Map templateParams = new HashMap<>(); - templateParams.put("name", brandProperties.getMessageTemplateName()); + templateParams.put("name", resolveSmsTemplateName()); templateParams.put("code", code); templateParams.put("min", "5"); templateParams.put("minutes", "5"); @@ -237,4 +237,20 @@ public class MessageHubClientServiceImpl implements MessageHubClientService { messageBody.put("templateParams", templateParams); return messageBody; } + + private String resolveSmsTemplateName() { + String configuredName = brandProperties.getMessageTemplateName(); + if (!StringUtils.hasText(configuredName)) { + return "Salon"; + } + StringBuilder normalizedName = new StringBuilder(); + configuredName.codePoints() + .filter(codePoint -> (codePoint >= 'A' && codePoint <= 'Z') + || (codePoint >= 'a' && codePoint <= 'z') + || (codePoint >= '0' && codePoint <= '9') + || Character.UnicodeScript.of(codePoint) == Character.UnicodeScript.HAN) + .limit(10) + .forEach(normalizedName::appendCodePoint); + return normalizedName.length() == 0 ? "Salon" : normalizedName.toString(); + } }