Skip to content

Commit

Permalink
Merge branch 'source-develop' into dev-icp
Browse files Browse the repository at this point in the history
* source-develop:
  🆕 binarywang#3217 增加 solon-plugins 适配
  🔖 发布 4.6.4.B 测试版本
  🆕 【微信支付】新增 平台收付通(补差)的3个接口方法
  🆕【微信支付】增加商家转账到零钱结果回调的解析方法
  🐛【微信支付】修复商家转账到零钱-查询批次单needQueryDetail为false时非必传参数为null的问题
  🎨 binarywang#3345  【小程序】获取手机号 getPhoneNoInfo方法兼容旧版本
  🐛 binarywang#3348 【公共问题】修复无法获取正确文件名的问题
  🎨 优化代码,规范注释
  🐛 binarywang#3223 【小程序】修复微信虚拟支付签名校验失败的问题
  🎨 完善部分代码注释,修复 yaml 未自动提示 hosts 配置问题
  🆕 binarywang#3347 【开放平台】新增小程序备案相关接口
  🎨 binarywang#3343 【小程序】媒资管理新增字段status以支持审核状态展示
  🎨 binarywang#3333 【企业微信】设置应用在用户工作台展示的webview型数据时,支持enable_webview_click参数设置
  🆕  binarywang#3340【微信支付】增加直连商户付款码支付和撤销支付订单的V3版接口实现
  🆕 binarywang#3339 【企业微信】增加上传临时素材的重载方法
  🎨 binarywang#3337 【视频号小店】 订单详情字段补充、售后新特性补充
  🎨 Bump org.bouncycastle:bcpkix-jdk18on & bcprov-jdk18on from 1.78 to 1.78.1
  🔖 发布 4.6.3.B 测试版本
  • Loading branch information
Molzx committed Sep 4, 2024
2 parents bfa1672 + 098abf3 commit 5193d83
Show file tree
Hide file tree
Showing 143 changed files with 6,041 additions and 67 deletions.
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java</artifactId>
<version>4.6.2.B</version>
<version>4.6.4.B</version>
<packaging>pom</packaging>
<name>WxJava - Weixin/Wechat Java SDK</name>
<description>微信开发Java SDK</description>
Expand Down Expand Up @@ -126,6 +126,7 @@
<module>weixin-java-qidian</module>
<module>weixin-java-channel</module>
<module>spring-boot-starters</module>
<module>solon-plugins</module>
<!--module>weixin-java-osgi</module-->
</modules>

Expand Down
44 changes: 44 additions & 0 deletions solon-plugins/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.github.binarywang</groupId>
<artifactId>wx-java</artifactId>
<version>4.6.4.B</version>
</parent>
<packaging>pom</packaging>
<artifactId>wx-java-solon-plugins</artifactId>
<name>WxJava - Solon Plugins</name>
<description>WxJava 各个模块的 Solon Plugin</description>

<properties>
<solon.version>2.9.2</solon.version>
</properties>

<modules>
<module>wx-java-miniapp-solon-plugin</module>
<module>wx-java-mp-multi-solon-plugin</module>
<module>wx-java-mp-solon-plugin</module>
<module>wx-java-pay-solon-plugin</module>
<module>wx-java-open-solon-plugin</module>
<module>wx-java-qidian-solon-plugin</module>
<module>wx-java-cp-multi-solon-plugin</module>
<module>wx-java-cp-solon-plugin</module>
<module>wx-java-channel-solon-plugin</module>
</modules>

<dependencies>
<dependency>
<groupId>org.noear</groupId>
<artifactId>solon</artifactId>
<version>${solon.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
31 changes: 31 additions & 0 deletions solon-plugins/wx-java-channel-solon-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>wx-java-solon-plugins</artifactId>
<groupId>com.github.binarywang</groupId>
<version>4.6.4.B</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>wx-java-channel-solon-plugin</artifactId>
<name>WxJava - Solon Plugin for Channel</name>
<description>微信视频号开发的 Solon Plugin</description>

<dependencies>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-channel</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.binarywang.solon.wxjava.channel.config;


import com.binarywang.solon.wxjava.channel.properties.WxChannelProperties;
import lombok.AllArgsConstructor;
import me.chanjar.weixin.channel.api.WxChannelService;
import me.chanjar.weixin.channel.api.impl.WxChannelServiceImpl;
import me.chanjar.weixin.channel.config.WxChannelConfig;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Condition;
import org.noear.solon.annotation.Configuration;

/**
* 微信小程序平台相关服务自动注册
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Configuration
@AllArgsConstructor
public class WxChannelServiceAutoConfiguration {
private final WxChannelProperties properties;

/**
* Channel Service
*
* @return Channel Service
*/
@Bean
@Condition(onMissingBean=WxChannelService.class, onBean = WxChannelConfig.class)
public WxChannelService wxChannelService(WxChannelConfig wxChannelConfig) {
WxChannelService wxChannelService = new WxChannelServiceImpl();
wxChannelService.setConfig(wxChannelConfig);
return wxChannelService;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.binarywang.solon.wxjava.channel.config.storage;

import com.binarywang.solon.wxjava.channel.properties.WxChannelProperties;
import me.chanjar.weixin.channel.config.impl.WxChannelDefaultConfigImpl;
import org.apache.commons.lang3.StringUtils;

/**
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
public abstract class AbstractWxChannelConfigStorageConfiguration {

protected WxChannelDefaultConfigImpl config(WxChannelDefaultConfigImpl config, WxChannelProperties properties) {
config.setAppid(StringUtils.trimToNull(properties.getAppid()));
config.setSecret(StringUtils.trimToNull(properties.getSecret()));
config.setToken(StringUtils.trimToNull(properties.getToken()));
config.setAesKey(StringUtils.trimToNull(properties.getAesKey()));
config.setMsgDataFormat(StringUtils.trimToNull(properties.getMsgDataFormat()));

WxChannelProperties.ConfigStorage configStorageProperties = properties.getConfigStorage();
config.setHttpProxyHost(configStorageProperties.getHttpProxyHost());
config.setHttpProxyUsername(configStorageProperties.getHttpProxyUsername());
config.setHttpProxyPassword(configStorageProperties.getHttpProxyPassword());
if (configStorageProperties.getHttpProxyPort() != null) {
config.setHttpProxyPort(configStorageProperties.getHttpProxyPort());
}

int maxRetryTimes = configStorageProperties.getMaxRetryTimes();
if (configStorageProperties.getMaxRetryTimes() < 0) {
maxRetryTimes = 0;
}
int retrySleepMillis = configStorageProperties.getRetrySleepMillis();
if (retrySleepMillis < 0) {
retrySleepMillis = 1000;
}
config.setRetrySleepMillis(retrySleepMillis);
config.setMaxRetryTimes(maxRetryTimes);
return config;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package com.binarywang.solon.wxjava.channel.config.storage;


import com.binarywang.solon.wxjava.channel.properties.RedisProperties;
import com.binarywang.solon.wxjava.channel.properties.WxChannelProperties;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.channel.config.WxChannelConfig;
import me.chanjar.weixin.channel.config.impl.WxChannelRedisConfigImpl;
import me.chanjar.weixin.common.redis.JedisWxRedisOps;
import me.chanjar.weixin.common.redis.WxRedisOps;
import org.apache.commons.lang3.StringUtils;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Condition;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.core.AppContext;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

/**
* @author <a href="https://github.com/lixize">Zeyes</a>
* @author noear
*/
@Configuration
@Condition(
onProperty = "${"+WxChannelProperties.PREFIX + ".configStorage.type} = jedis",
onClass = JedisPool.class
)
@RequiredArgsConstructor
public class WxChannelInJedisConfigStorageConfiguration extends AbstractWxChannelConfigStorageConfiguration {
private final WxChannelProperties properties;
private final AppContext applicationContext;

@Bean
@Condition(onMissingBean=WxChannelConfig.class)
public WxChannelConfig wxChannelConfig() {
WxChannelRedisConfigImpl config = getWxChannelRedisConfig();
return this.config(config, properties);
}

private WxChannelRedisConfigImpl getWxChannelRedisConfig() {
RedisProperties redisProperties = properties.getConfigStorage().getRedis();
JedisPool jedisPool;
if (redisProperties != null && StringUtils.isNotEmpty(redisProperties.getHost())) {
jedisPool = getJedisPool();
} else {
jedisPool = applicationContext.getBean(JedisPool.class);
}
WxRedisOps redisOps = new JedisWxRedisOps(jedisPool);
return new WxChannelRedisConfigImpl(redisOps, properties.getConfigStorage().getKeyPrefix());
}

private JedisPool getJedisPool() {
WxChannelProperties.ConfigStorage storage = properties.getConfigStorage();
RedisProperties redis = storage.getRedis();

JedisPoolConfig config = new JedisPoolConfig();
if (redis.getMaxActive() != null) {
config.setMaxTotal(redis.getMaxActive());
}
if (redis.getMaxIdle() != null) {
config.setMaxIdle(redis.getMaxIdle());
}
if (redis.getMaxWaitMillis() != null) {
config.setMaxWaitMillis(redis.getMaxWaitMillis());
}
if (redis.getMinIdle() != null) {
config.setMinIdle(redis.getMinIdle());
}
config.setTestOnBorrow(true);
config.setTestWhileIdle(true);

return new JedisPool(config, redis.getHost(), redis.getPort(), redis.getTimeout(), redis.getPassword(), redis.getDatabase());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.binarywang.solon.wxjava.channel.config.storage;


import com.binarywang.solon.wxjava.channel.properties.WxChannelProperties;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.channel.config.WxChannelConfig;
import me.chanjar.weixin.channel.config.impl.WxChannelDefaultConfigImpl;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Condition;
import org.noear.solon.annotation.Configuration;

/**
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Configuration
@Condition(
onProperty = "${"+WxChannelProperties.PREFIX + ".configStorage.type:memory} = memory"
)
@RequiredArgsConstructor
public class WxChannelInMemoryConfigStorageConfiguration extends AbstractWxChannelConfigStorageConfiguration {
private final WxChannelProperties properties;

@Bean
@Condition(onMissingBean = WxChannelProperties.class)
public WxChannelConfig wxChannelConfig() {
WxChannelDefaultConfigImpl config = new WxChannelDefaultConfigImpl();
return this.config(config, properties);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.binarywang.solon.wxjava.channel.config.storage;


import com.binarywang.solon.wxjava.channel.properties.RedisProperties;
import com.binarywang.solon.wxjava.channel.properties.WxChannelProperties;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.channel.config.WxChannelConfig;
import me.chanjar.weixin.channel.config.impl.WxChannelRedissonConfigImpl;
import org.apache.commons.lang3.StringUtils;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Condition;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.core.AppContext;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.TransportMode;

/**
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
@Configuration
@Condition(
onProperty = "${"+WxChannelProperties.PREFIX + ".configStorage.type} = redisson",
onClass = Redisson.class
)
@RequiredArgsConstructor
public class WxChannelInRedissonConfigStorageConfiguration extends AbstractWxChannelConfigStorageConfiguration {
private final WxChannelProperties properties;
private final AppContext applicationContext;

@Bean
@Condition(onMissingBean=WxChannelConfig.class)
public WxChannelConfig wxChannelConfig() {
WxChannelRedissonConfigImpl config = getWxChannelRedissonConfig();
return this.config(config, properties);
}

private WxChannelRedissonConfigImpl getWxChannelRedissonConfig() {
RedisProperties redisProperties = properties.getConfigStorage().getRedis();
RedissonClient redissonClient;
if (redisProperties != null && StringUtils.isNotEmpty(redisProperties.getHost())) {
redissonClient = getRedissonClient();
} else {
redissonClient = applicationContext.getBean(RedissonClient.class);
}
return new WxChannelRedissonConfigImpl(redissonClient, properties.getConfigStorage().getKeyPrefix());
}

private RedissonClient getRedissonClient() {
WxChannelProperties.ConfigStorage storage = properties.getConfigStorage();
RedisProperties redis = storage.getRedis();

Config config = new Config();
config.useSingleServer()
.setAddress("redis://" + redis.getHost() + ":" + redis.getPort())
.setDatabase(redis.getDatabase())
.setPassword(redis.getPassword());
config.setTransportMode(TransportMode.NIO);
return Redisson.create(config);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.binarywang.solon.wxjava.channel.enums;

/**
* httpclient类型
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
public enum HttpClientType {
/**
* HttpClient
*/
HttpClient
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.binarywang.solon.wxjava.channel.enums;

/**
* storage类型
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
public enum StorageType {
/**
* 内存
*/
Memory,
/**
* redis(JedisClient)
*/
Jedis,
/**
* redis(Redisson)
*/
Redisson,
/**
* redis(RedisTemplate)
*/
RedisTemplate
}
Loading

0 comments on commit 5193d83

Please sign in to comment.