From da12f4d460c9629b97bb06b1552b23b1454012ea Mon Sep 17 00:00:00 2001 From: czt Date: Sat, 18 Nov 2023 14:12:40 +0000 Subject: [PATCH] =?UTF-8?q?:art:=20=E4=BF=AE=E5=A4=8D=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=9D=A5=E8=87=AA=E5=BE=AE=E4=BF=A1=E5=BC=80=E6=94=BE=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E7=9A=84=E5=BC=82=E6=AD=A5=E6=B6=88=E6=81=AF=E6=97=B6?= =?UTF-8?q?=E4=BC=9A=E5=9B=A0=E4=B8=BAconfigStorageMap=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E4=BB=BB=E4=BD=95=E5=85=AC=E4=BC=97=E5=8F=B7=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=EF=BC=8C=E6=9C=80=E7=BB=88=E4=BC=9A=E4=B8=BB?= =?UTF-8?q?=E5=8A=A8=E6=8A=9B=E5=87=BA=E6=97=A0=E6=B3=95=E6=89=BE=E5=88=B0?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E5=85=AC=E4=BC=97=E5=8F=B7=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weixin/open/api/impl/WxOpenMpServiceImpl.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMpServiceImpl.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMpServiceImpl.java index c0e6cb9cb..576db4a22 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMpServiceImpl.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMpServiceImpl.java @@ -5,7 +5,9 @@ import com.google.common.collect.ImmutableMap; import com.google.gson.JsonObject; import lombok.SneakyThrows; import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; +import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; import me.chanjar.weixin.mp.config.WxMpConfigStorage; import me.chanjar.weixin.open.api.WxOpenComponentService; import me.chanjar.weixin.open.api.WxOpenMpService; @@ -14,7 +16,9 @@ import me.chanjar.weixin.open.bean.result.WxAmpLinkResult; import me.chanjar.weixin.open.bean.result.WxOpenResult; import java.net.URLEncoder; +import java.util.Map; import java.util.Objects; +import java.util.function.Function; /** * @author 007 @@ -24,13 +28,23 @@ public class WxOpenMpServiceImpl extends WxMpServiceImpl implements WxOpenMpServ private WxMpConfigStorage wxMpConfigStorage; private String appId; + /** + * + * @param wxOpenComponentService + * @param appId + * @param wxMpConfigStorage + */ public WxOpenMpServiceImpl(WxOpenComponentService wxOpenComponentService, String appId, WxMpConfigStorage wxMpConfigStorage) { // wxOpenComponentService.oauth2getAccessToken(appId) this.wxOpenComponentService = wxOpenComponentService; this.appId = appId; this.wxMpConfigStorage = wxMpConfigStorage; setOAuth2Service(new WxOpenMpOAuth2ServiceImpl(wxOpenComponentService, getOAuth2Service(), wxMpConfigStorage)); + //添加addConfigStorage是为了解决处理来自微信开放平台的异步消息时调用WxMpServiceImpl.switchoverTo(String, Function),因为configStorageMap没有任何公众号配置信息,最终会主动抛出无法找到对应公众号配置异常的问题。 + //Issue:https://gitee.com/binary/weixin-java-tools/issues/I81AAF + addConfigStorage(appId,wxMpConfigStorage); initHttp(); + } @Override