diff --git a/pom.xml b/pom.xml
index c283450..087c548 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@
1.11.3
3.17
7.2.18
- 3.4.0
+ 3.5.0
1.5.4
2.9.2
1.9.3
diff --git a/yami-shop-mp/src/main/java/com/yami/shop/mp/component/WxMaInRedisConfig.java b/yami-shop-mp/src/main/java/com/yami/shop/mp/component/WxMaInRedisConfig.java
index d89efd6..236f96a 100644
--- a/yami-shop-mp/src/main/java/com/yami/shop/mp/component/WxMaInRedisConfig.java
+++ b/yami-shop-mp/src/main/java/com/yami/shop/mp/component/WxMaInRedisConfig.java
@@ -10,7 +10,7 @@
package com.yami.shop.mp.component;
-import cn.binarywang.wx.miniapp.config.WxMaInMemoryConfig;
+import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import com.yami.shop.common.annotation.RedisLock;
import com.yami.shop.common.util.RedisUtil;
import com.yami.shop.mp.config.bean.WxMiniApp;
@@ -29,7 +29,7 @@ import java.util.concurrent.locks.Lock;
* @author LGH
*/
@Component
-public class WxMaInRedisConfig extends WxMaInMemoryConfig {
+public class WxMaInRedisConfig extends WxMaDefaultConfigImpl {
private static final String ACCESS_TOKEN_KEY = "wxMa:access_token:";
diff --git a/yami-shop-mp/src/main/java/com/yami/shop/mp/component/WxMaServiceClusterImpl.java b/yami-shop-mp/src/main/java/com/yami/shop/mp/component/WxMaServiceClusterImpl.java
index 3ebbd5f..a36601c 100644
--- a/yami-shop-mp/src/main/java/com/yami/shop/mp/component/WxMaServiceClusterImpl.java
+++ b/yami-shop-mp/src/main/java/com/yami/shop/mp/component/WxMaServiceClusterImpl.java
@@ -4,6 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.hutool.http.HttpUtil;
import com.yami.shop.common.exception.YamiShopBindException;
+import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.bean.WxAccessToken;
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
@@ -16,9 +17,9 @@ import java.util.concurrent.TimeUnit;
* WxMaServiceImpl 在集群模式获取accessToken的方式
* @author LGH
*/
+@Slf4j
public class WxMaServiceClusterImpl extends WxMaServiceImpl {
-
private static final String REDISSON_LOCK_PREFIX = "redisson_lock:";
private RedissonClient redissonClient;
@@ -47,7 +48,7 @@ public class WxMaServiceClusterImpl extends WxMaServiceImpl {
throw new YamiShopBindException("服务器繁忙,请稍后再试");
}
- if (this.getWxMaConfig().isAccessTokenExpired() && !forceRefresh) {
+ if (!this.getWxMaConfig().isAccessTokenExpired()) {
return this.getWxMaConfig().getAccessToken();
}
diff --git a/yami-shop-mp/src/main/java/com/yami/shop/mp/component/WxMpInRedisConfigStorage.java b/yami-shop-mp/src/main/java/com/yami/shop/mp/component/WxMpInRedisConfigStorage.java
index cf9f384..481cba7 100644
--- a/yami-shop-mp/src/main/java/com/yami/shop/mp/component/WxMpInRedisConfigStorage.java
+++ b/yami-shop-mp/src/main/java/com/yami/shop/mp/component/WxMpInRedisConfigStorage.java
@@ -14,7 +14,7 @@ import com.yami.shop.common.annotation.RedisLock;
import com.yami.shop.common.util.RedisUtil;
import com.yami.shop.mp.config.bean.WxMp;
import me.chanjar.weixin.common.bean.WxAccessToken;
-import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
+import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
import me.chanjar.weixin.mp.enums.TicketType;
import org.springframework.stereotype.Component;
@@ -26,7 +26,7 @@ import org.springframework.stereotype.Component;
* @author LGH
*/
@Component
-public class WxMpInRedisConfigStorage extends WxMpInMemoryConfigStorage {
+public class WxMpInRedisConfigStorage extends WxMpDefaultConfigImpl {
private static final String ACCESS_TOKEN_KEY = "wxMp:access_token:";
diff --git a/yami-shop-mp/src/main/java/com/yami/shop/mp/component/WxMpServiceClusterImpl.java b/yami-shop-mp/src/main/java/com/yami/shop/mp/component/WxMpServiceClusterImpl.java
index 5eec0ec..bae99df 100644
--- a/yami-shop-mp/src/main/java/com/yami/shop/mp/component/WxMpServiceClusterImpl.java
+++ b/yami-shop-mp/src/main/java/com/yami/shop/mp/component/WxMpServiceClusterImpl.java
@@ -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);