|
@@ -1,15 +1,5 @@
|
|
|
package me.chanjar.weixin.mp.api.impl;
|
|
|
|
|
|
-import java.io.IOException;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.concurrent.locks.Lock;
|
|
|
-
|
|
|
-import me.chanjar.weixin.mp.api.*;
|
|
|
-import me.chanjar.weixin.mp.util.WxMpConfigStorageHolder;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
-
|
|
|
import com.google.gson.JsonArray;
|
|
|
import com.google.gson.JsonElement;
|
|
|
import com.google.gson.JsonObject;
|
|
@@ -22,17 +12,22 @@ import me.chanjar.weixin.common.session.WxSessionManager;
|
|
|
import me.chanjar.weixin.common.util.DataUtils;
|
|
|
import me.chanjar.weixin.common.util.RandomUtils;
|
|
|
import me.chanjar.weixin.common.util.crypto.SHA1;
|
|
|
-import me.chanjar.weixin.common.util.http.RequestExecutor;
|
|
|
-import me.chanjar.weixin.common.util.http.RequestHttp;
|
|
|
-import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor;
|
|
|
-import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor;
|
|
|
-import me.chanjar.weixin.common.util.http.URIUtil;
|
|
|
+import me.chanjar.weixin.common.util.http.*;
|
|
|
+import me.chanjar.weixin.mp.api.*;
|
|
|
import me.chanjar.weixin.mp.bean.WxMpSemanticQuery;
|
|
|
import me.chanjar.weixin.mp.bean.result.WxMpCurrentAutoReplyInfo;
|
|
|
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
|
|
|
import me.chanjar.weixin.mp.bean.result.WxMpSemanticQueryResult;
|
|
|
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
|
|
import me.chanjar.weixin.mp.enums.TicketType;
|
|
|
+import me.chanjar.weixin.mp.util.WxMpConfigStorageHolder;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.concurrent.locks.Lock;
|
|
|
|
|
|
/**
|
|
|
* 基础实现类.
|
|
@@ -66,7 +61,7 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH
|
|
|
private WxMpWifiService wifiService = new WxMpWifiServiceImpl(this);
|
|
|
private WxMpMarketingService marketingService = new WxMpMarketingServiceImpl(this);
|
|
|
|
|
|
- private HashMap<String, WxMpConfigStorage> wxMpConfigStoragePool;
|
|
|
+ private Map<String, WxMpConfigStorage> wxMpConfigStoragePool;
|
|
|
private boolean isMultiWxApp = false;
|
|
|
|
|
|
private int retrySleepMillis = 1000;
|
|
@@ -340,9 +335,9 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH
|
|
|
@Override
|
|
|
public WxMpConfigStorage getWxMpConfigStorage() {
|
|
|
if (isMultiWxApp) {
|
|
|
- String label = WxMpConfigStorageHolder.get();
|
|
|
- return wxMpConfigStoragePool.getOrDefault(label, null);
|
|
|
+ return wxMpConfigStoragePool.get(WxMpConfigStorageHolder.get());
|
|
|
}
|
|
|
+
|
|
|
return this.wxMpConfigStorage;
|
|
|
}
|
|
|
|
|
@@ -353,7 +348,7 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void setMultiWxMpConfigStorage(HashMap<String, WxMpConfigStorage> configStorages) {
|
|
|
+ public void setMultiWxMpConfigStorage(Map<String, WxMpConfigStorage> configStorages) {
|
|
|
wxMpConfigStoragePool = configStorages;
|
|
|
isMultiWxApp = true;
|
|
|
this.initHttp();
|