From 8e760a972ddbe9e79ca29d3b3d0499de36a293bf Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Dec 2025 09:37:25 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20#3654=20=E3=80=90=E5=BC=80=E6=94=BE?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E3=80=91=E6=B6=88=E6=81=AF=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E5=A4=84=E7=90=86=E7=A8=8B=E5=BA=8F=E5=A2=9E=E5=8A=A0=E5=AF=B9?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/api/impl/WxOpenMessageRouter.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMessageRouter.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMessageRouter.java index 7314bfd69..3c2c3058f 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMessageRouter.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMessageRouter.java @@ -23,4 +23,29 @@ public class WxOpenMessageRouter extends WxMpMessageRouter { public WxMpXmlOutMessage route(final WxMpXmlMessage wxMessage, final Map context, String appId) { return route(wxMessage, context, wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appId)); } + + /** + * 路由微信消息到小程序服务 (Route WeChat message to Mini App service) + * + * @param wxMessage the wx message + * @param appId the app id + * @return the wx mp xml out message + */ + public WxMpXmlOutMessage routeForMa(final WxMpXmlMessage wxMessage, String appId) { + return routeForMa(wxMessage, new HashMap<>(), appId); + } + + /** + * 路由微信消息到小程序服务 (Route WeChat message to Mini App service) + * + * @param wxMessage the wx message + * @param context the context + * @param appId the app id + * @return the wx mp xml out message + */ + public WxMpXmlOutMessage routeForMa(final WxMpXmlMessage wxMessage, final Map context, String appId) { + // 将小程序服务放入上下文中,以便处理器可以访问 (Put Mini App service in context so handlers can access it) + context.put("wxOpenMaService", wxOpenService.getWxOpenComponentService().getWxMaServiceByAppid(appId)); + return route(wxMessage, context, wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appId)); + } }