Skip to content

Commit 8e760a9

Browse files
authored
🎨 #3654 【开放平台】消息路由处理程序增加对小程序的支持
1 parent b601b55 commit 8e760a9

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMessageRouter.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,29 @@ public WxMpXmlOutMessage route(final WxMpXmlMessage wxMessage, String appId) {
2323
public WxMpXmlOutMessage route(final WxMpXmlMessage wxMessage, final Map<String, Object> context, String appId) {
2424
return route(wxMessage, context, wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appId));
2525
}
26+
27+
/**
28+
* 路由微信消息到小程序服务 (Route WeChat message to Mini App service)
29+
*
30+
* @param wxMessage the wx message
31+
* @param appId the app id
32+
* @return the wx mp xml out message
33+
*/
34+
public WxMpXmlOutMessage routeForMa(final WxMpXmlMessage wxMessage, String appId) {
35+
return routeForMa(wxMessage, new HashMap<>(), appId);
36+
}
37+
38+
/**
39+
* 路由微信消息到小程序服务 (Route WeChat message to Mini App service)
40+
*
41+
* @param wxMessage the wx message
42+
* @param context the context
43+
* @param appId the app id
44+
* @return the wx mp xml out message
45+
*/
46+
public WxMpXmlOutMessage routeForMa(final WxMpXmlMessage wxMessage, final Map<String, Object> context, String appId) {
47+
// 将小程序服务放入上下文中,以便处理器可以访问 (Put Mini App service in context so handlers can access it)
48+
context.put("wxOpenMaService", wxOpenService.getWxOpenComponentService().getWxMaServiceByAppid(appId));
49+
return route(wxMessage, context, wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appId));
50+
}
2651
}

0 commit comments

Comments
 (0)