From 0d62afe609bc83e3b457a8af895ac2c16fc8c6d0 Mon Sep 17 00:00:00 2001 From: Will Kang Date: Sun, 20 Oct 2024 12:27:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=89=94=E9=99=A4=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E5=B0=81=E7=A6=81=E6=A3=80=E6=B5=8B=EF=BC=8C=E5=8D=87?= =?UTF-8?q?=E7=BA=A7release=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 7 +- wechat-bom/pom.xml | 4 +- wechat-core/pom.xml | 4 +- wechat-mp/pom.xml | 2 +- wechat-platform/pom.xml | 25 +----- .../message/mp/WaBanCheckMessageHandler.java | 81 ------------------- wechat-work/pom.xml | 2 +- 7 files changed, 13 insertions(+), 112 deletions(-) delete mode 100644 wechat-platform/src/main/java/org/kangspace/wechat/helper/platform/message/mp/WaBanCheckMessageHandler.java diff --git a/pom.xml b/pom.xml index e4a65cd..e0691c0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.kangspace.wechat.helper wechat-helper - 0.1.2-SNAPSHOT + 0.1.2 pom wechat-helper @@ -399,6 +399,11 @@ + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + org.sonatype.plugins diff --git a/wechat-bom/pom.xml b/wechat-bom/pom.xml index eb6e01e..4671749 100644 --- a/wechat-bom/pom.xml +++ b/wechat-bom/pom.xml @@ -5,13 +5,13 @@ org.kangspace.wechat.helper wechat-helper - 0.1.2-SNAPSHOT + 0.1.2 4.0.0 pom wechat-bom - 0.1.2-SNAPSHOT + 0.1.2 微信开发助手-SDK模块集合 diff --git a/wechat-core/pom.xml b/wechat-core/pom.xml index 4b13372..cef4c32 100644 --- a/wechat-core/pom.xml +++ b/wechat-core/pom.xml @@ -5,12 +5,12 @@ org.kangspace.wechat.helper wechat-helper - 0.1.2-SNAPSHOT + 0.1.2 ../pom.xml 4.0.0 wechat-core - 0.1.2-SNAPSHOT + 0.1.2 微信开发助手-公共代码模块 diff --git a/wechat-mp/pom.xml b/wechat-mp/pom.xml index 8a2e944..916ab81 100644 --- a/wechat-mp/pom.xml +++ b/wechat-mp/pom.xml @@ -6,7 +6,7 @@ org.kangspace.wechat.helper wechat-helper - 0.1.2-SNAPSHOT + 0.1.2 ../pom.xml diff --git a/wechat-platform/pom.xml b/wechat-platform/pom.xml index 967dd42..b9822e2 100644 --- a/wechat-platform/pom.xml +++ b/wechat-platform/pom.xml @@ -5,7 +5,7 @@ wechat-helper org.kangspace.wechat.helper - 0.1.2-SNAPSHOT + 0.1.2 4.0.0 @@ -20,22 +20,6 @@ 2.7.2 default - - - wechat-ban-check - - wechat-ban-check - - - - org.kangspace.wechat.helper - ban-helper - 1.0.0 - compile - - - - @@ -80,13 +64,6 @@ test - - - org.kangspace.wechat.helper - ban-helper - 1.0.0 - provided - diff --git a/wechat-platform/src/main/java/org/kangspace/wechat/helper/platform/message/mp/WaBanCheckMessageHandler.java b/wechat-platform/src/main/java/org/kangspace/wechat/helper/platform/message/mp/WaBanCheckMessageHandler.java deleted file mode 100644 index eb70f3a..0000000 --- a/wechat-platform/src/main/java/org/kangspace/wechat/helper/platform/message/mp/WaBanCheckMessageHandler.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.kangspace.wechat.helper.platform.message.mp; - -import lombok.extern.slf4j.Slf4j; -import org.kangspace.wechat.helper.banhelper.wa.WaBanCheckResult; -import org.kangspace.wechat.helper.banhelper.wa.WaBanChecker; -import org.kangspace.wechat.helper.core.message.MessageResolverContext; -import org.kangspace.wechat.helper.core.util.WeChatAppIdHelper; -import org.kangspace.wechat.helper.mp.WeChatMpService; -import org.kangspace.wechat.helper.mp.constant.MessageConstant; -import org.kangspace.wechat.helper.mp.message.TextMessage; -import org.kangspace.wechat.helper.mp.message.WeChatMpMessage; -import org.kangspace.wechat.helper.mp.message.WeChatMpMessageHandler; -import org.kangspace.wechat.helper.mp.message.response.TextEchoMessage; -import org.kangspace.wechat.helper.mp.message.response.WeChatMpEchoMessage; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; - -/** - * 小程序封禁检查处理器 - * - * @author kango2gler@gmail.com - * @since 0.1.1 - */ -@Slf4j -@Profile("wechat-ban-check") -@Component -public class WaBanCheckMessageHandler implements WeChatMpMessageHandler { - @Resource - private WaBanChecker waBanChecker; - - @Override - public WeChatMpEchoMessage handle(WeChatMpService service, WeChatMpMessage message, - MessageResolverContext context) { - log.info("公众号消息解析器(小程序封禁检测): message: {}, context: {}", message, context); - MessageConstant.MessageType messageType = message.getMsgType(); - if (MessageConstant.MessageType.TEXT.equals(messageType)) { - String content = ((TextMessage) message).getContent().trim(); - // 1. 检查是否为AppId - if (WeChatAppIdHelper.isAppId(content)) { - // 2. 检查是否被封禁 - WaBanCheckResult banCheckResult = waBanChecker.banCheck(content); - if (banCheckResult.isSucceed()) { - log.info("公众号消息解析器(小程序封禁检测): 命中, appId: {}, 结果: {}", content, banCheckResult); - StringBuilder contentBuffer = new StringBuilder(); - contentBuffer.append("AppId: ").append(content).append("\n"); - contentBuffer.append("小程序名称: ").append(banCheckResult.getAppName()).append("\n"); - boolean isBanned = banCheckResult.getBanned(); - contentBuffer.append("小程序状态: ").append(isBanned ? "封禁" : "正常").append("\n"); - if (isBanned) { - if (banCheckResult.getReason() != null) { - contentBuffer.append("封禁原因: ").append(banCheckResult.getReason()).append("\n"); - } - if (banCheckResult.getDetail() != null) { - contentBuffer.append("封禁详情: ").append(banCheckResult.getDetail()).append("\n"); - } - } - return new TextEchoMessage(message.getFromUser(), message.getToUser(), contentBuffer.toString()); - } - } - } - log.info("公众号消息解析器(小程序封禁检测): 未命中"); - return null; - } - - @Configuration - public static class BanHelperConfigure { - @Bean - public WaBanChecker waBanChecker() { - return new WaBanChecker(); - } - } - - @Override - public Integer getOrder() { - return 1; - } -} diff --git a/wechat-work/pom.xml b/wechat-work/pom.xml index be1e025..0fc50db 100644 --- a/wechat-work/pom.xml +++ b/wechat-work/pom.xml @@ -5,7 +5,7 @@ wechat-helper org.kangspace.wechat.helper - 0.1.2-SNAPSHOT + 0.1.2 4.0.0