Skip to content

Commit 098abf3

Browse files
committed
Merge branch 'develop' of github.com:Wechat-Group/WxJava into source-develop
* 'develop' of github.com:Wechat-Group/WxJava: 🆕 binarywang#3217 增加 solon-plugins 适配 🔖 发布 4.6.4.B 测试版本 🆕 【微信支付】新增 平台收付通(补差)的3个接口方法 🆕【微信支付】增加商家转账到零钱结果回调的解析方法 🐛【微信支付】修复商家转账到零钱-查询批次单needQueryDetail为false时非必传参数为null的问题 🎨 binarywang#3345 【小程序】获取手机号 getPhoneNoInfo方法兼容旧版本 🐛 binarywang#3348 【公共问题】修复无法获取正确文件名的问题 🎨 优化代码,规范注释 🐛 binarywang#3223 【小程序】修复微信虚拟支付签名校验失败的问题
2 parents 6a87c67 + 41bb5e4 commit 098abf3

File tree

140 files changed

+6021
-66
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+6021
-66
lines changed

pom.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.github.binarywang</groupId>
55
<artifactId>wx-java</artifactId>
6-
<version>4.6.3.B</version>
6+
<version>4.6.4.B</version>
77
<packaging>pom</packaging>
88
<name>WxJava - Weixin/Wechat Java SDK</name>
99
<description>微信开发Java SDK</description>
@@ -126,6 +126,7 @@
126126
<module>weixin-java-qidian</module>
127127
<module>weixin-java-channel</module>
128128
<module>spring-boot-starters</module>
129+
<module>solon-plugins</module>
129130
<!--module>weixin-java-osgi</module-->
130131
</modules>
131132

solon-plugins/pom.xml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
4+
xmlns="http://maven.apache.org/POM/4.0.0">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>com.github.binarywang</groupId>
8+
<artifactId>wx-java</artifactId>
9+
<version>4.6.4.B</version>
10+
</parent>
11+
<packaging>pom</packaging>
12+
<artifactId>wx-java-solon-plugins</artifactId>
13+
<name>WxJava - Solon Plugins</name>
14+
<description>WxJava 各个模块的 Solon Plugin</description>
15+
16+
<properties>
17+
<solon.version>2.9.2</solon.version>
18+
</properties>
19+
20+
<modules>
21+
<module>wx-java-miniapp-solon-plugin</module>
22+
<module>wx-java-mp-multi-solon-plugin</module>
23+
<module>wx-java-mp-solon-plugin</module>
24+
<module>wx-java-pay-solon-plugin</module>
25+
<module>wx-java-open-solon-plugin</module>
26+
<module>wx-java-qidian-solon-plugin</module>
27+
<module>wx-java-cp-multi-solon-plugin</module>
28+
<module>wx-java-cp-solon-plugin</module>
29+
<module>wx-java-channel-solon-plugin</module>
30+
</modules>
31+
32+
<dependencies>
33+
<dependency>
34+
<groupId>org.noear</groupId>
35+
<artifactId>solon</artifactId>
36+
<version>${solon.version}</version>
37+
</dependency>
38+
<dependency>
39+
<groupId>org.projectlombok</groupId>
40+
<artifactId>lombok</artifactId>
41+
<scope>provided</scope>
42+
</dependency>
43+
</dependencies>
44+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<parent>
4+
<artifactId>wx-java-solon-plugins</artifactId>
5+
<groupId>com.github.binarywang</groupId>
6+
<version>4.6.4.B</version>
7+
</parent>
8+
<modelVersion>4.0.0</modelVersion>
9+
10+
<artifactId>wx-java-channel-solon-plugin</artifactId>
11+
<name>WxJava - Solon Plugin for Channel</name>
12+
<description>微信视频号开发的 Solon Plugin</description>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>com.github.binarywang</groupId>
17+
<artifactId>weixin-java-channel</artifactId>
18+
<version>${project.version}</version>
19+
</dependency>
20+
<dependency>
21+
<groupId>redis.clients</groupId>
22+
<artifactId>jedis</artifactId>
23+
<scope>provided</scope>
24+
</dependency>
25+
<dependency>
26+
<groupId>org.redisson</groupId>
27+
<artifactId>redisson</artifactId>
28+
<scope>provided</scope>
29+
</dependency>
30+
</dependencies>
31+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.binarywang.solon.wxjava.channel.config;
2+
3+
4+
import com.binarywang.solon.wxjava.channel.properties.WxChannelProperties;
5+
import lombok.AllArgsConstructor;
6+
import me.chanjar.weixin.channel.api.WxChannelService;
7+
import me.chanjar.weixin.channel.api.impl.WxChannelServiceImpl;
8+
import me.chanjar.weixin.channel.config.WxChannelConfig;
9+
import org.noear.solon.annotation.Bean;
10+
import org.noear.solon.annotation.Condition;
11+
import org.noear.solon.annotation.Configuration;
12+
13+
/**
14+
* 微信小程序平台相关服务自动注册
15+
*
16+
* @author <a href="https://github.com/lixize">Zeyes</a>
17+
*/
18+
@Configuration
19+
@AllArgsConstructor
20+
public class WxChannelServiceAutoConfiguration {
21+
private final WxChannelProperties properties;
22+
23+
/**
24+
* Channel Service
25+
*
26+
* @return Channel Service
27+
*/
28+
@Bean
29+
@Condition(onMissingBean=WxChannelService.class, onBean = WxChannelConfig.class)
30+
public WxChannelService wxChannelService(WxChannelConfig wxChannelConfig) {
31+
WxChannelService wxChannelService = new WxChannelServiceImpl();
32+
wxChannelService.setConfig(wxChannelConfig);
33+
return wxChannelService;
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.binarywang.solon.wxjava.channel.config.storage;
2+
3+
import com.binarywang.solon.wxjava.channel.properties.WxChannelProperties;
4+
import me.chanjar.weixin.channel.config.impl.WxChannelDefaultConfigImpl;
5+
import org.apache.commons.lang3.StringUtils;
6+
7+
/**
8+
* @author <a href="https://github.com/lixize">Zeyes</a>
9+
*/
10+
public abstract class AbstractWxChannelConfigStorageConfiguration {
11+
12+
protected WxChannelDefaultConfigImpl config(WxChannelDefaultConfigImpl config, WxChannelProperties properties) {
13+
config.setAppid(StringUtils.trimToNull(properties.getAppid()));
14+
config.setSecret(StringUtils.trimToNull(properties.getSecret()));
15+
config.setToken(StringUtils.trimToNull(properties.getToken()));
16+
config.setAesKey(StringUtils.trimToNull(properties.getAesKey()));
17+
config.setMsgDataFormat(StringUtils.trimToNull(properties.getMsgDataFormat()));
18+
19+
WxChannelProperties.ConfigStorage configStorageProperties = properties.getConfigStorage();
20+
config.setHttpProxyHost(configStorageProperties.getHttpProxyHost());
21+
config.setHttpProxyUsername(configStorageProperties.getHttpProxyUsername());
22+
config.setHttpProxyPassword(configStorageProperties.getHttpProxyPassword());
23+
if (configStorageProperties.getHttpProxyPort() != null) {
24+
config.setHttpProxyPort(configStorageProperties.getHttpProxyPort());
25+
}
26+
27+
int maxRetryTimes = configStorageProperties.getMaxRetryTimes();
28+
if (configStorageProperties.getMaxRetryTimes() < 0) {
29+
maxRetryTimes = 0;
30+
}
31+
int retrySleepMillis = configStorageProperties.getRetrySleepMillis();
32+
if (retrySleepMillis < 0) {
33+
retrySleepMillis = 1000;
34+
}
35+
config.setRetrySleepMillis(retrySleepMillis);
36+
config.setMaxRetryTimes(maxRetryTimes);
37+
return config;
38+
}
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package com.binarywang.solon.wxjava.channel.config.storage;
2+
3+
4+
import com.binarywang.solon.wxjava.channel.properties.RedisProperties;
5+
import com.binarywang.solon.wxjava.channel.properties.WxChannelProperties;
6+
import lombok.RequiredArgsConstructor;
7+
import me.chanjar.weixin.channel.config.WxChannelConfig;
8+
import me.chanjar.weixin.channel.config.impl.WxChannelRedisConfigImpl;
9+
import me.chanjar.weixin.common.redis.JedisWxRedisOps;
10+
import me.chanjar.weixin.common.redis.WxRedisOps;
11+
import org.apache.commons.lang3.StringUtils;
12+
import org.noear.solon.annotation.Bean;
13+
import org.noear.solon.annotation.Condition;
14+
import org.noear.solon.annotation.Configuration;
15+
import org.noear.solon.core.AppContext;
16+
import redis.clients.jedis.JedisPool;
17+
import redis.clients.jedis.JedisPoolConfig;
18+
19+
/**
20+
* @author <a href="https://github.com/lixize">Zeyes</a>
21+
* @author noear
22+
*/
23+
@Configuration
24+
@Condition(
25+
onProperty = "${"+WxChannelProperties.PREFIX + ".configStorage.type} = jedis",
26+
onClass = JedisPool.class
27+
)
28+
@RequiredArgsConstructor
29+
public class WxChannelInJedisConfigStorageConfiguration extends AbstractWxChannelConfigStorageConfiguration {
30+
private final WxChannelProperties properties;
31+
private final AppContext applicationContext;
32+
33+
@Bean
34+
@Condition(onMissingBean=WxChannelConfig.class)
35+
public WxChannelConfig wxChannelConfig() {
36+
WxChannelRedisConfigImpl config = getWxChannelRedisConfig();
37+
return this.config(config, properties);
38+
}
39+
40+
private WxChannelRedisConfigImpl getWxChannelRedisConfig() {
41+
RedisProperties redisProperties = properties.getConfigStorage().getRedis();
42+
JedisPool jedisPool;
43+
if (redisProperties != null && StringUtils.isNotEmpty(redisProperties.getHost())) {
44+
jedisPool = getJedisPool();
45+
} else {
46+
jedisPool = applicationContext.getBean(JedisPool.class);
47+
}
48+
WxRedisOps redisOps = new JedisWxRedisOps(jedisPool);
49+
return new WxChannelRedisConfigImpl(redisOps, properties.getConfigStorage().getKeyPrefix());
50+
}
51+
52+
private JedisPool getJedisPool() {
53+
WxChannelProperties.ConfigStorage storage = properties.getConfigStorage();
54+
RedisProperties redis = storage.getRedis();
55+
56+
JedisPoolConfig config = new JedisPoolConfig();
57+
if (redis.getMaxActive() != null) {
58+
config.setMaxTotal(redis.getMaxActive());
59+
}
60+
if (redis.getMaxIdle() != null) {
61+
config.setMaxIdle(redis.getMaxIdle());
62+
}
63+
if (redis.getMaxWaitMillis() != null) {
64+
config.setMaxWaitMillis(redis.getMaxWaitMillis());
65+
}
66+
if (redis.getMinIdle() != null) {
67+
config.setMinIdle(redis.getMinIdle());
68+
}
69+
config.setTestOnBorrow(true);
70+
config.setTestWhileIdle(true);
71+
72+
return new JedisPool(config, redis.getHost(), redis.getPort(), redis.getTimeout(), redis.getPassword(), redis.getDatabase());
73+
}
74+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.binarywang.solon.wxjava.channel.config.storage;
2+
3+
4+
import com.binarywang.solon.wxjava.channel.properties.WxChannelProperties;
5+
import lombok.RequiredArgsConstructor;
6+
import me.chanjar.weixin.channel.config.WxChannelConfig;
7+
import me.chanjar.weixin.channel.config.impl.WxChannelDefaultConfigImpl;
8+
import org.noear.solon.annotation.Bean;
9+
import org.noear.solon.annotation.Condition;
10+
import org.noear.solon.annotation.Configuration;
11+
12+
/**
13+
* @author <a href="https://github.com/lixize">Zeyes</a>
14+
*/
15+
@Configuration
16+
@Condition(
17+
onProperty = "${"+WxChannelProperties.PREFIX + ".configStorage.type:memory} = memory"
18+
)
19+
@RequiredArgsConstructor
20+
public class WxChannelInMemoryConfigStorageConfiguration extends AbstractWxChannelConfigStorageConfiguration {
21+
private final WxChannelProperties properties;
22+
23+
@Bean
24+
@Condition(onMissingBean = WxChannelProperties.class)
25+
public WxChannelConfig wxChannelConfig() {
26+
WxChannelDefaultConfigImpl config = new WxChannelDefaultConfigImpl();
27+
return this.config(config, properties);
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package com.binarywang.solon.wxjava.channel.config.storage;
2+
3+
4+
import com.binarywang.solon.wxjava.channel.properties.RedisProperties;
5+
import com.binarywang.solon.wxjava.channel.properties.WxChannelProperties;
6+
import lombok.RequiredArgsConstructor;
7+
import me.chanjar.weixin.channel.config.WxChannelConfig;
8+
import me.chanjar.weixin.channel.config.impl.WxChannelRedissonConfigImpl;
9+
import org.apache.commons.lang3.StringUtils;
10+
import org.noear.solon.annotation.Bean;
11+
import org.noear.solon.annotation.Condition;
12+
import org.noear.solon.annotation.Configuration;
13+
import org.noear.solon.core.AppContext;
14+
import org.redisson.Redisson;
15+
import org.redisson.api.RedissonClient;
16+
import org.redisson.config.Config;
17+
import org.redisson.config.TransportMode;
18+
19+
/**
20+
* @author <a href="https://github.com/lixize">Zeyes</a>
21+
*/
22+
@Configuration
23+
@Condition(
24+
onProperty = "${"+WxChannelProperties.PREFIX + ".configStorage.type} = redisson",
25+
onClass = Redisson.class
26+
)
27+
@RequiredArgsConstructor
28+
public class WxChannelInRedissonConfigStorageConfiguration extends AbstractWxChannelConfigStorageConfiguration {
29+
private final WxChannelProperties properties;
30+
private final AppContext applicationContext;
31+
32+
@Bean
33+
@Condition(onMissingBean=WxChannelConfig.class)
34+
public WxChannelConfig wxChannelConfig() {
35+
WxChannelRedissonConfigImpl config = getWxChannelRedissonConfig();
36+
return this.config(config, properties);
37+
}
38+
39+
private WxChannelRedissonConfigImpl getWxChannelRedissonConfig() {
40+
RedisProperties redisProperties = properties.getConfigStorage().getRedis();
41+
RedissonClient redissonClient;
42+
if (redisProperties != null && StringUtils.isNotEmpty(redisProperties.getHost())) {
43+
redissonClient = getRedissonClient();
44+
} else {
45+
redissonClient = applicationContext.getBean(RedissonClient.class);
46+
}
47+
return new WxChannelRedissonConfigImpl(redissonClient, properties.getConfigStorage().getKeyPrefix());
48+
}
49+
50+
private RedissonClient getRedissonClient() {
51+
WxChannelProperties.ConfigStorage storage = properties.getConfigStorage();
52+
RedisProperties redis = storage.getRedis();
53+
54+
Config config = new Config();
55+
config.useSingleServer()
56+
.setAddress("redis://" + redis.getHost() + ":" + redis.getPort())
57+
.setDatabase(redis.getDatabase())
58+
.setPassword(redis.getPassword());
59+
config.setTransportMode(TransportMode.NIO);
60+
return Redisson.create(config);
61+
}
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.binarywang.solon.wxjava.channel.enums;
2+
3+
/**
4+
* httpclient类型
5+
*
6+
* @author <a href="https://github.com/lixize">Zeyes</a>
7+
*/
8+
public enum HttpClientType {
9+
/**
10+
* HttpClient
11+
*/
12+
HttpClient
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.binarywang.solon.wxjava.channel.enums;
2+
3+
/**
4+
* storage类型
5+
*
6+
* @author <a href="https://github.com/lixize">Zeyes</a>
7+
*/
8+
public enum StorageType {
9+
/**
10+
* 内存
11+
*/
12+
Memory,
13+
/**
14+
* redis(JedisClient)
15+
*/
16+
Jedis,
17+
/**
18+
* redis(Redisson)
19+
*/
20+
Redisson,
21+
/**
22+
* redis(RedisTemplate)
23+
*/
24+
RedisTemplate
25+
}

0 commit comments

Comments
 (0)