mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-02 20:02:37 +08:00
🐛 #1426 修复多公众号管理的两个问题
1、允许动态更新公众号的配置,原有逻辑:更新配置时会报“该公众号标识已存在,请更换其他标识!”; 2、多公众号的消息路由,原有逻辑问题:handler里WxMpConfigStorageHolder不能获取到appid,意味着用的wxmpservice不对,只会走默认的,已测试存在该问题
This commit is contained in:
parent
e3c6aff3cb
commit
0a99706b74
@ -152,6 +152,13 @@ public class WxMpMessageRouter {
|
||||
return route(wxMessage, context, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理不同appid微信消息
|
||||
*/
|
||||
public WxMpXmlOutMessage route(final String appid, final WxMpXmlMessage wxMessage, final Map<String, Object> context) {
|
||||
return route(wxMessage, context, this.wxMpService.switchoverTo(appid));
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理微信消息.
|
||||
*/
|
||||
@ -228,6 +235,10 @@ public class WxMpMessageRouter {
|
||||
return this.route(wxMessage, new HashMap<String, Object>(2));
|
||||
}
|
||||
|
||||
public WxMpXmlOutMessage route(String appid, final WxMpXmlMessage wxMessage) {
|
||||
return this.route(appid, wxMessage, new HashMap<String, Object>(2));
|
||||
}
|
||||
|
||||
private boolean isMsgDuplicated(WxMpXmlMessage wxMessage) {
|
||||
StringBuilder messageId = new StringBuilder();
|
||||
if (wxMessage.getMsgId() == null) {
|
||||
|
@ -399,9 +399,6 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH
|
||||
@Override
|
||||
public void addConfigStorage(String mpId, WxMpConfigStorage configStorages) {
|
||||
synchronized (this) {
|
||||
if (this.configStorageMap.containsKey(mpId)) {
|
||||
throw new RuntimeException("该公众号标识已存在,请更换其他标识!");
|
||||
}
|
||||
this.configStorageMap.put(mpId, configStorages);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user