55import com .google .gson .JsonObject ;
66import lombok .SneakyThrows ;
77import me .chanjar .weixin .common .error .WxErrorException ;
8+ import me .chanjar .weixin .mp .api .WxMpService ;
89import me .chanjar .weixin .mp .api .impl .WxMpServiceImpl ;
10+ import me .chanjar .weixin .mp .bean .message .WxMpXmlMessage ;
911import me .chanjar .weixin .mp .config .WxMpConfigStorage ;
1012import me .chanjar .weixin .open .api .WxOpenComponentService ;
1113import me .chanjar .weixin .open .api .WxOpenMpService ;
1416import me .chanjar .weixin .open .bean .result .WxOpenResult ;
1517
1618import java .net .URLEncoder ;
19+ import java .util .Map ;
1720import java .util .Objects ;
21+ import java .util .function .Function ;
1822
1923/**
2024 * @author <a href="https://github.com/007gzs">007</a>
@@ -24,13 +28,23 @@ public class WxOpenMpServiceImpl extends WxMpServiceImpl implements WxOpenMpServ
2428 private WxMpConfigStorage wxMpConfigStorage ;
2529 private String appId ;
2630
31+ /**
32+ *
33+ * @param wxOpenComponentService
34+ * @param appId
35+ * @param wxMpConfigStorage
36+ */
2737 public WxOpenMpServiceImpl (WxOpenComponentService wxOpenComponentService , String appId , WxMpConfigStorage wxMpConfigStorage ) {
2838// wxOpenComponentService.oauth2getAccessToken(appId)
2939 this .wxOpenComponentService = wxOpenComponentService ;
3040 this .appId = appId ;
3141 this .wxMpConfigStorage = wxMpConfigStorage ;
3242 setOAuth2Service (new WxOpenMpOAuth2ServiceImpl (wxOpenComponentService , getOAuth2Service (), wxMpConfigStorage ));
43+ //添加addConfigStorage是为了解决处理来自微信开放平台的异步消息时调用WxMpServiceImpl.switchoverTo(String, Function),因为configStorageMap没有任何公众号配置信息,最终会主动抛出无法找到对应公众号配置异常的问题。
44+ //Issue:https://gitee.com/binary/weixin-java-tools/issues/I81AAF
45+ addConfigStorage (appId ,wxMpConfigStorage );
3346 initHttp ();
47+
3448 }
3549
3650 @ Override
0 commit comments