Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 767fdd5

Browse filesBrowse files
🎨 #3261【公众号】增加是否启用 StableAccessToken的配置
1 parent 976b2b5 commit 767fdd5
Copy full SHA for 767fdd5

File tree

Expand file treeCollapse file tree

6 files changed

+28
-15
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+28
-15
lines changed

‎spring-boot-starters/wx-java-mp-multi-spring-boot-starter/README.md

Copy file name to clipboardExpand all lines: spring-boot-starters/wx-java-mp-multi-spring-boot-starter/README.md
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
## 选填
2020
wx.mp.tenantId1.token=@token
2121
wx.mp.tenantId1.aes-key=@aesKey
22+
wx.mp.tenantId1.use-stable-access-token=@useStableAccessToken
2223
## 应用 2 配置(必填)
2324
wx.mp.tenantId2.app-id=@appId
2425
wx.mp.tenantId2.app-secret =@secret
2526
## 选填
2627
wx.mp.tenantId2.token=@token
2728
wx.mp.tenantId2.aes-key=@aesKey
29+
wx.mp.tenantId2.use-stable-access-token=@useStableAccessToken
2830

2931
# ConfigStorage 配置(选填)
3032
## 配置类型: memory(默认), jedis, redisson, redis_template

‎spring-boot-starters/wx-java-mp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/mp/configuration/services/AbstractWxMpConfiguration.java

Copy file name to clipboardExpand all lines: spring-boot-starters/wx-java-mp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/mp/configuration/services/AbstractWxMpConfiguration.java
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ private void configApp(WxMpDefaultConfigImpl config, WxMpSingleProperties corpPr
115115
String appSecret = corpProperties.getAppSecret();
116116
String token = corpProperties.getToken();
117117
String aesKey = corpProperties.getAesKey();
118+
boolean useStableAccessToken = corpProperties.isUseStableAccessToken();
118119

119120
config.setAppId(appId);
120121
config.setSecret(appSecret);
@@ -124,6 +125,7 @@ private void configApp(WxMpDefaultConfigImpl config, WxMpSingleProperties corpPr
124125
if (StringUtils.isNotBlank(aesKey)) {
125126
config.setAesKey(aesKey);
126127
}
128+
config.setUseStableAccessToken(useStableAccessToken);
127129
}
128130

129131
private void configHttp(WxMpDefaultConfigImpl config, WxMpMultiProperties.ConfigStorage storage) {

‎spring-boot-starters/wx-java-mp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/mp/properties/WxMpSingleProperties.java

Copy file name to clipboardExpand all lines: spring-boot-starters/wx-java-mp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/mp/properties/WxMpSingleProperties.java
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,9 @@ public class WxMpSingleProperties implements Serializable {
3232
* 设置微信公众号的 EncodingAESKey.
3333
*/
3434
private String aesKey;
35+
36+
/**
37+
* 是否使用稳定版 Access Token
38+
*/
39+
private boolean useStableAccessToken = false;
3540
}
+12-13Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# wx-java-mp-spring-boot-starter
2+
23
## 快速开始
4+
35
1. 引入依赖
46
```xml
57
<dependency>
@@ -11,15 +13,16 @@
1113
2. 添加配置(application.properties)
1214
```properties
1315
# 公众号配置(必填)
14-
wx.mp.appId = appId
15-
wx.mp.secret = @secret
16-
wx.mp.token = @token
17-
wx.mp.aesKey = @aesKey
16+
wx.mp.app-id=appId
17+
wx.mp.secret=@secret
18+
wx.mp.token=@token
19+
wx.mp.aes-key=@aesKey
20+
wx.mp.use-stable-access-token=@useStableAccessToken
1821
# 存储配置redis(可选)
19-
wx.mp.config-storage.type = Jedis # 配置类型: Memory(默认), Jedis, RedisTemplate
20-
wx.mp.config-storage.key-prefix = wx # 相关redis前缀配置: wx(默认)
21-
wx.mp.config-storage.redis.host = 127.0.0.1
22-
wx.mp.config-storage.redis.port = 6379
22+
wx.mp.config-storage.type= edis # 配置类型: Memory(默认), Jedis, RedisTemplate
23+
wx.mp.config-storage.key-prefix=wx # 相关redis前缀配置: wx(默认)
24+
wx.mp.config-storage.redis.host=127.0.0.1
25+
wx.mp.config-storage.redis.port=6379
2326
#单机和sentinel同时存在时,优先使用sentinel配置
2427
#wx.mp.config-storage.redis.sentinel-ips=127.0.0.1:16379,127.0.0.1:26379
2528
#wx.mp.config-storage.redis.sentinel-name=mymaster
@@ -35,13 +38,9 @@
3538
#wx.mp.hosts.mp-host=http://proxy.com/
3639
```
3740
3. 自动注入的类型
41+
3842
- `WxMpService`
3943
- `WxMpConfigStorage`
4044

4145
4、参考demo:
4246
https://github.com/binarywang/wx-java-mp-demo
43-
44-
45-
46-
47-

‎spring-boot-starters/wx-java-mp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/mp/config/WxMpStorageAutoConfiguration.java

Copy file name to clipboardExpand all lines: spring-boot-starters/wx-java-mp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/mp/config/WxMpStorageAutoConfiguration.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import me.chanjar.weixin.common.redis.JedisWxRedisOps;
1010
import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps;
1111
import me.chanjar.weixin.common.redis.WxRedisOps;
12-
import me.chanjar.weixin.mp.config.WxMpHostConfig;
1312
import me.chanjar.weixin.mp.config.WxMpConfigStorage;
13+
import me.chanjar.weixin.mp.config.WxMpHostConfig;
1414
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
1515
import me.chanjar.weixin.mp.config.impl.WxMpRedisConfigImpl;
1616
import org.apache.commons.lang3.StringUtils;
@@ -122,7 +122,7 @@ private void setWxMpInfo(WxMpDefaultConfigImpl config) {
122122
config.setSecret(properties.getSecret());
123123
config.setToken(properties.getToken());
124124
config.setAesKey(properties.getAesKey());
125-
125+
config.setUseStableAccessToken(wxMpProperties.isUseStableAccessToken());
126126
config.setHttpProxyHost(configStorageProperties.getHttpProxyHost());
127127
config.setHttpProxyUsername(configStorageProperties.getHttpProxyUsername());
128128
config.setHttpProxyPassword(configStorageProperties.getHttpProxyPassword());

‎spring-boot-starters/wx-java-mp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/mp/properties/WxMpProperties.java

Copy file name to clipboardExpand all lines: spring-boot-starters/wx-java-mp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/mp/properties/WxMpProperties.java
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ public class WxMpProperties {
4040
* 设置微信公众号的EncodingAESKey.
4141
*/
4242
private String aesKey;
43+
44+
/**
45+
* 是否使用稳定版 Access Token
46+
*/
47+
private boolean useStableAccessToken = false;
4348

4449
/**
4550
* 自定义host配置

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.