-
-
Notifications
You must be signed in to change notification settings - Fork 9k
为 WxOpenMessageRouter 添加 WxOpenMaService 支持,新增 routeForMa 方法 #3654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
3
commits into
develop
Choose a base branch
from
copilot/fix-3629
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+28
−3
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…thods Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] WxOpenMessageRouter类方法中中缺少对WxOpenMaService的支持
Add WxOpenMaService support to WxOpenMessageRouter with routeForMa methods
Jul 24, 2025
Owner
|
@copilot 请用中文改下描述文字 |
Contributor
Author
已将 PR 描述改为中文。 |
Copilot
AI
changed the title
Add WxOpenMaService support to WxOpenMessageRouter with routeForMa methods
为 WxOpenMessageRouter 添加 WxOpenMaService 支持,新增 routeForMa 方法
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
本 PR 为 WxOpenMessageRouter 添加了小程序服务支持,同时修复了微信支付退款通知中的字段名拼写错误。主要目的是使开发者能够在处理开放平台消息时访问小程序特定的 API 功能。
- 新增
routeForMa方法,支持将WxOpenMaService注入到消息处理上下文中 - 修复
WxPayRefundNotifyResult.ReqInfo类中的字段名拼写错误:refundRecvAccout→refundRecvAccount - 更新相应的测试用例以使用正确的方法名
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMessageRouter.java | 新增 routeForMa 方法,通过 context 将 WxOpenMaService 传递给消息处理器,实现小程序消息路由支持 |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/notify/WxPayRefundNotifyResult.java | 修正字段名拼写:refundRecvAccout → refundRecvAccount(保持 XML 别名不变以匹配微信 API) |
| weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/notify/WxPayRefundNotifyResultTest.java | 更新测试用例以使用修正后的 getter 方法名 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
问题描述
WxOpenMessageRouter类原本只支持将消息路由到WxMpService(公众号),但缺少对WxOpenMaService(小程序)的支持。这导致开发者在通过路由器处理小程序消息时无法访问小程序特定的功能。用户原始问题:
解决方案
在
WxOpenMessageRouter中新增了两个方法,将WxOpenMaService注入到消息上下文中:routeForMa(WxMpXmlMessage wxMessage, String appId)- 路由小程序消息并自动注入服务routeForMa(WxMpXmlMessage wxMessage, Map<String, Object> context, String appId)- 支持自定义上下文并注入服务主要特性:
route()方法保持不变context.get("wxOpenMaService")获取WxOpenMaServiceWxMpXmlMessage格式使用方式
开发者现在可以在处理器中访问
WxOpenMaService:这使开发者能够通过现有的路由器基础设施处理小程序审核事件、代码提交和其他小程序特定操作。
修复 #3629。
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.