|
@@ -6,18 +6,19 @@ import me.chanjar.weixin.common.WxType;
|
|
|
import me.chanjar.weixin.common.bean.WxAccessToken;
|
|
|
import me.chanjar.weixin.common.error.WxError;
|
|
|
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.api.impl.WxMpServiceHttpClientImpl;
|
|
|
import org.redisson.api.RLock;
|
|
|
import org.redisson.api.RedissonClient;
|
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
+import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Other.GET_ACCESS_TOKEN_URL;
|
|
|
+
|
|
|
/**
|
|
|
* WxMpServiceImpl 在集群模式获取accessToken的方式
|
|
|
* @author LGH
|
|
|
*/
|
|
|
-public class WxMpServiceClusterImpl extends WxMpServiceImpl {
|
|
|
+public class WxMpServiceClusterImpl extends WxMpServiceHttpClientImpl {
|
|
|
|
|
|
|
|
|
private static final String REDISSON_LOCK_PREFIX = "redisson_lock:";
|
|
@@ -48,12 +49,10 @@ public class WxMpServiceClusterImpl extends WxMpServiceImpl {
|
|
|
throw new YamiShopBindException("服务器繁忙,请稍后再试");
|
|
|
}
|
|
|
|
|
|
- if (this.getWxMpConfigStorage().isAccessTokenExpired()) {
|
|
|
+ if (!this.getWxMpConfigStorage().isAccessTokenExpired()) {
|
|
|
return this.getWxMpConfigStorage().getAccessToken();
|
|
|
}
|
|
|
-
|
|
|
- String url = String.format(WxMpService.GET_ACCESS_TOKEN_URL,
|
|
|
- this.getWxMpConfigStorage().getAppId(), this.getWxMpConfigStorage().getSecret());
|
|
|
+ String url = String.format(GET_ACCESS_TOKEN_URL.getUrl(this.getWxMpConfigStorage()), this.getWxMpConfigStorage().getAppId(), this.getWxMpConfigStorage().getSecret());
|
|
|
String resultContent = HttpUtil.get(url);
|
|
|
|
|
|
WxError error = WxError.fromJson(resultContent, WxType.MP);
|