Skip to content

Commit 2b1c2b7

Browse files
authored
Merge pull request #2 from Wechat-Group/develop
从主库更新
2 parents 2bc7eba + 8e0a6a3 commit 2b1c2b7

File tree

334 files changed

+18404
-882
lines changed

Some content is hidden

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

334 files changed

+18404
-882
lines changed

README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<tr>
2020
<td align="left" valign="middle">
2121
<a href="http://mp.weixin.qq.com/mp/homepage?__biz=MzI3MzAwMzk4OA==&hid=1&sn=f31af3bf562b116b061c9ab4edf70b61&scene=18#wechat_redirect" target="_blank">
22-
<img height="120" src="https://gitee.com/binary/weixin-java-tools/raw/master/images/qrcodes/mp.png">
22+
<img height="120" src="https://gitee.com/binary/weixin-java-tools/raw/develop/images/qrcodes/mp.png">
2323
</a>
2424
</td>
2525
<td align="center" valign="middle" width="250">
@@ -30,23 +30,17 @@
3030
</td>
3131
<td align="center" valign="middle">
3232
<a href="https://promotion.aliyun.com/ntms/act/qwbk.html?userCode=7makzf5h" target="_blank">
33-
<img height="120" src="https://gitee.com/binary/weixin-java-tools/raw/master/images/banners/aliyun.jpg">
34-
</a>
35-
</td>
36-
<td align="center" valign="middle">
37-
<a href="https://cloud.tencent.com/redirect.php?redirect=1014&cps_key=a4c06ffe004dbcda44036daa1bf8f876&from=console" target="_blank">
38-
<img height="120" src="https://gitee.com/binary/weixin-java-tools/raw/master/images/banners/tcloud.jpg">
33+
<img height="120" src="https://gitee.com/binary/weixin-java-tools/raw/develop/images/banners/aliyun.jpg">
3934
</a>
4035
</td>
4136
</tr>
4237
</tbody>
4338
</table>
4439

4540
### 重要信息
46-
1. **2020-11-29 发布 [【4.0.0正式版】](https://mp.weixin.qq.com/s/OPoICwLifOZGVN_ZX_BBhw)**
41+
1. **2021-06-02 发布 [【4.1.0正式版】](https://mp.weixin.qq.com/s/nIk_xOf6dxkhKfqq830Cuw)**
4742
1. 新手重要提示:本项目仅是一个SDK开发工具包,未提供Web实现,建议使用 `maven``gradle` 引用本项目即可使用本SDK提供的各种功能,详情可参考 **[【Demo项目】](demo.md)** 或本项目中的部分单元测试代码;另外微信开发新手请务必阅读[【开发文档 Wiki 首页】](https://github.com/Wechat-Group/WxJava/wiki)的常见问题部分,可以少走很多弯路,节省不少时间。
4843
1. 技术交流群:想获得QQ群/微信群/钉钉企业群等信息的同学,请使用微信扫描上面的微信公众号二维码关注 `WxJava` 后点击相关菜单即可获取加入方式,同时也可以在微信中搜索 `weixin-java-tools``WxJava` 后选择正确的公众号进行关注,该公众号会及时通知SDK相关更新信息,并不定期分享微信Java开发相关技术知识;
49-
1. 付费QQ群:(**注意:刚入群会有5分钟禁言,稍等片刻即可正常发言**[![加入QQ群](https://img.shields.io/badge/QQ群-343954419-blue.svg)](http://shang.qq.com/wpa/qunwpa?idkey=731dc3e7ea31ebe25376cc1a791445468612c63fd0e9e05399b088ec81fd9e15)[![加入QQ群](https://img.shields.io/badge/QQ群-343954419-blue.svg)](http://jq.qq.com/?_wv=1027&k=40lRskK),或者请自行搜索群号`343954419`进行添加;当然由于某种原因无法入群的,可关注公众号后获取其他群的加入方式;
5044
1. 钉钉技术交流群: `30294972`(技术交流群),`35724728`(通知群,实时通知Github项目变更记录)。
5145
1. 微信开发新手或者Java开发新手在群内提问或新开Issue提问前,请先阅读[【提问的智慧】](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md),并确保已查阅过 [【开发文档Wiki】](https://github.com/wechat-group/WxJava/wiki) ,避免浪费大家的宝贵时间;
5246
1. 寻求帮助时需贴代码或大长串异常信息的,请利用 http://paste.ubuntu.com
@@ -73,7 +67,7 @@
7367
<dependency>
7468
<groupId>com.github.binarywang</groupId>
7569
<artifactId>(不同模块参考下文)</artifactId>
76-
<version>4.0.0</version>
70+
<version>4.1.0</version>
7771
</dependency>
7872
```
7973

@@ -105,14 +99,15 @@
10599

106100
#### 开源项目:
107101
- 基于微信公众号的签到、抽奖、发送弹幕程序:https://github.com/workcheng/weiya
108-
- XxPay聚合支付https://github.com/jmdhappy/xxpay-master
102+
- Jeepay 支付系统https://gitee.com/jeequan/jeepay
109103
- 微同商城:https://gitee.com/fuyang_lipengjun/platform
110104
- 微信点餐系统:https://github.com/sqmax/springboot-project
111105
- 专注批量推送的小而美的工具:https://github.com/rememberber/WePush
112106
- yshop意象商城系统:https://gitee.com/guchengwuyue/yshopmall
113107
- wx-manage(微信公众号管理项目):https://github.com/niefy/wx-manage
114108
- 基于若依开发的微信公众号管理系统:https://gitee.com/joolun/JooLun-wx
115109
- SAAS微信小程序电商:https://gitee.com/wei-it/weiit-saas
110+
- mall4j 电商商城系统:https://gitee.com/gz-yami/mall4j
116111

117112
#### 小程序:
118113
- (京东)友家铺子,友家铺子店长版,京粉精选
@@ -129,6 +124,8 @@
129124
- 王朝社区(比亚迪新能源社区)
130125
- 极吼吼手机上门回收换新
131126
- 未来信封
127+
- 5G惠享
128+
- 生菜wordpress转小程序
132129

133130
#### 公众号:
134131
- 中国电信上海网厅(sh_189)
@@ -145,10 +142,13 @@
145142
- 好行景区直通车以及全国40多个公众号
146143
- 我奥篮球公众号
147144
- 未来信封官微
145+
- 银川智云问诊
146+
- 5G惠享
148147

149-
#### 企业号/企业微信:
148+
#### 企业微信:
150149
- HTC企业微信
151150
- 掌上史丹利
151+
- 药店益
152152

153153
#### 其他:
154154
- 高善人力资源

others/weixin-java-osgi/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<dependency>
2929
<groupId>com.thoughtworks.xstream</groupId>
3030
<artifactId>xstream</artifactId>
31-
<version>1.4.15</version>
31+
<version>1.4.17</version>
3232
<scope>provided</scope>
3333
<exclusions>
3434
<exclusion>

pom.xml

+5-5
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.0.6.B</version>
6+
<version>4.1.0</version>
77
<packaging>pom</packaging>
88
<name>WxJava - Weixin/Wechat Java SDK</name>
99
<description>微信开发Java SDK</description>
@@ -118,7 +118,7 @@
118118
<maven.compiler.target>1.8</maven.compiler.target>
119119

120120
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
121-
<httpclient.version>4.5</httpclient.version>
121+
<httpclient.version>4.5.13</httpclient.version>
122122
<jetty.version>9.4.38.v20210224</jetty.version>
123123
</properties>
124124

@@ -160,7 +160,7 @@
160160
<dependency>
161161
<groupId>commons-io</groupId>
162162
<artifactId>commons-io</artifactId>
163-
<version>2.5</version>
163+
<version>2.7</version>
164164
</dependency>
165165
<dependency>
166166
<groupId>org.apache.commons</groupId>
@@ -175,12 +175,12 @@
175175
<dependency>
176176
<groupId>com.thoughtworks.xstream</groupId>
177177
<artifactId>xstream</artifactId>
178-
<version>1.4.16</version>
178+
<version>1.4.17</version>
179179
</dependency>
180180
<dependency>
181181
<groupId>com.google.guava</groupId>
182182
<artifactId>guava</artifactId>
183-
<version>29.0-jre</version>
183+
<version>30.0-jre</version>
184184
</dependency>
185185
<dependency>
186186
<groupId>com.google.code.gson</groupId>

spring-boot-starters/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.github.binarywang</groupId>
66
<artifactId>wx-java</artifactId>
7-
<version>4.0.6.B</version>
7+
<version>4.1.0</version>
88
</parent>
99
<packaging>pom</packaging>
1010
<artifactId>wx-java-spring-boot-starters</artifactId>

spring-boot-starters/wx-java-miniapp-spring-boot-starter/pom.xml

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>wx-java-spring-boot-starters</artifactId>
77
<groupId>com.github.binarywang</groupId>
8-
<version>4.0.6.B</version>
8+
<version>4.1.0</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

@@ -22,11 +22,18 @@
2222
<dependency>
2323
<groupId>redis.clients</groupId>
2424
<artifactId>jedis</artifactId>
25+
<scope>provided</scope>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.redisson</groupId>
29+
<artifactId>redisson</artifactId>
30+
<scope>provided</scope>
2531
</dependency>
2632
<dependency>
2733
<groupId>org.springframework.data</groupId>
2834
<artifactId>spring-data-redis</artifactId>
2935
<version>${spring.boot.version}</version>
36+
<scope>provided</scope>
3037
</dependency>
3138
</dependencies>
3239

Original file line numberDiff line numberDiff line change
@@ -1,148 +1,21 @@
11
package com.binarywang.spring.starter.wxjava.miniapp.config;
22

3-
import cn.binarywang.wx.miniapp.api.WxMaService;
4-
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceHttpClientImpl;
5-
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
6-
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceJoddHttpImpl;
7-
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceOkHttpImpl;
8-
import cn.binarywang.wx.miniapp.config.WxMaConfig;
9-
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
10-
import cn.binarywang.wx.miniapp.config.impl.WxMaRedisBetterConfigImpl;
11-
import com.binarywang.spring.starter.wxjava.miniapp.enums.HttpClientType;
12-
import com.binarywang.spring.starter.wxjava.miniapp.properties.RedisProperties;
133
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaProperties;
14-
import lombok.AllArgsConstructor;
15-
import me.chanjar.weixin.common.redis.JedisWxRedisOps;
16-
import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps;
17-
import me.chanjar.weixin.common.redis.WxRedisOps;
18-
import org.apache.commons.lang3.StringUtils;
19-
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
20-
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
21-
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
224
import org.springframework.boot.context.properties.EnableConfigurationProperties;
23-
import org.springframework.context.ApplicationContext;
24-
import org.springframework.context.annotation.Bean;
255
import org.springframework.context.annotation.Configuration;
26-
import org.springframework.data.redis.core.StringRedisTemplate;
27-
import redis.clients.jedis.JedisPool;
28-
import redis.clients.jedis.JedisPoolConfig;
6+
import org.springframework.context.annotation.Import;
297

308
/**
319
* 自动配置.
3210
*
3311
* @author <a href="https://github.com/binarywang">Binary Wang</a>
3412
* @date 2019-08-10
3513
*/
36-
@AllArgsConstructor
3714
@Configuration
38-
@ConditionalOnClass(WxMaService.class)
3915
@EnableConfigurationProperties(WxMaProperties.class)
40-
@ConditionalOnProperty(prefix = "wx.miniapp", value = "enabled", matchIfMissing = true)
16+
@Import({
17+
WxMaStorageAutoConfiguration.class,
18+
WxMaServiceAutoConfiguration.class
19+
})
4120
public class WxMaAutoConfiguration {
42-
43-
private final WxMaProperties wxMaProperties;
44-
private final ApplicationContext applicationContext;
45-
46-
/**
47-
* 小程序service.
48-
*
49-
* @return 小程序service
50-
*/
51-
@Bean
52-
@ConditionalOnMissingBean(WxMaService.class)
53-
public WxMaService service(WxMaConfig wxMaConfig) {
54-
HttpClientType httpClientType = wxMaProperties.getConfigStorage().getHttpClientType();
55-
WxMaService wxMaService;
56-
switch (httpClientType) {
57-
case OkHttp:
58-
wxMaService = new WxMaServiceOkHttpImpl();
59-
break;
60-
case JoddHttp:
61-
wxMaService = new WxMaServiceJoddHttpImpl();
62-
break;
63-
case HttpClient:
64-
wxMaService = new WxMaServiceHttpClientImpl();
65-
break;
66-
default:
67-
wxMaService = new WxMaServiceImpl();
68-
break;
69-
}
70-
wxMaService.setWxMaConfig(wxMaConfig);
71-
return wxMaService;
72-
}
73-
74-
@Bean
75-
@ConditionalOnMissingBean(WxMaConfig.class)
76-
public WxMaConfig wxMaConfig() {
77-
WxMaDefaultConfigImpl config;
78-
switch (wxMaProperties.getConfigStorage().getType()) {
79-
case Jedis:
80-
config = WxMaRedisBetterConfig.config(wxMaProperties, applicationContext);
81-
break;
82-
case RedisTemplate:
83-
config = wxMaRedisTemplateConfigStorage();
84-
break;
85-
default:
86-
config = wxMaDefaultConfigStorage();
87-
break;
88-
}
89-
90-
config.setAppid(StringUtils.trimToNull(this.wxMaProperties.getAppid()));
91-
config.setSecret(StringUtils.trimToNull(this.wxMaProperties.getSecret()));
92-
config.setToken(StringUtils.trimToNull(this.wxMaProperties.getToken()));
93-
config.setAesKey(StringUtils.trimToNull(this.wxMaProperties.getAesKey()));
94-
config.setMsgDataFormat(StringUtils.trimToNull(this.wxMaProperties.getMsgDataFormat()));
95-
96-
WxMaProperties.ConfigStorage configStorageProperties = wxMaProperties.getConfigStorage();
97-
config.setHttpProxyHost(configStorageProperties.getHttpProxyHost());
98-
config.setHttpProxyUsername(configStorageProperties.getHttpProxyUsername());
99-
config.setHttpProxyPassword(configStorageProperties.getHttpProxyPassword());
100-
if (configStorageProperties.getHttpProxyPort() != null) {
101-
config.setHttpProxyPort(configStorageProperties.getHttpProxyPort());
102-
}
103-
return config;
104-
}
105-
106-
private WxMaDefaultConfigImpl wxMaDefaultConfigStorage() {
107-
return new WxMaDefaultConfigImpl();
108-
}
109-
110-
private static class WxMaRedisBetterConfig {
111-
112-
private static WxMaDefaultConfigImpl config(WxMaProperties wxMaProperties, ApplicationContext context) {
113-
RedisProperties redisProperties = wxMaProperties.getConfigStorage().getRedis();
114-
JedisPool jedisPool;
115-
if (StringUtils.isNotEmpty(redisProperties.getHost())) {
116-
JedisPoolConfig config = new JedisPoolConfig();
117-
if (redisProperties.getMaxActive() != null) {
118-
config.setMaxTotal(redisProperties.getMaxActive());
119-
}
120-
if (redisProperties.getMaxIdle() != null) {
121-
config.setMaxIdle(redisProperties.getMaxIdle());
122-
}
123-
if (redisProperties.getMaxWaitMillis() != null) {
124-
config.setMaxWaitMillis(redisProperties.getMaxWaitMillis());
125-
}
126-
if (redisProperties.getMinIdle() != null) {
127-
config.setMinIdle(redisProperties.getMinIdle());
128-
}
129-
config.setTestOnBorrow(true);
130-
config.setTestWhileIdle(true);
131-
132-
jedisPool = new JedisPool(config, redisProperties.getHost(), redisProperties.getPort(),
133-
redisProperties.getTimeout(), redisProperties.getPassword(), redisProperties.getDatabase());
134-
} else {
135-
jedisPool = context.getBean(JedisPool.class);
136-
}
137-
WxRedisOps redisOps = new JedisWxRedisOps(jedisPool);
138-
return new WxMaRedisBetterConfigImpl(redisOps, wxMaProperties.getConfigStorage().getKeyPrefix());
139-
}
140-
}
141-
142-
143-
private WxMaDefaultConfigImpl wxMaRedisTemplateConfigStorage() {
144-
StringRedisTemplate redisTemplate = applicationContext.getBean(StringRedisTemplate.class);
145-
WxRedisOps redisOps = new RedisTemplateWxRedisOps(redisTemplate);
146-
return new WxMaRedisBetterConfigImpl(redisOps, wxMaProperties.getConfigStorage().getKeyPrefix());
147-
}
14821
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package com.binarywang.spring.starter.wxjava.miniapp.config;
2+
3+
import cn.binarywang.wx.miniapp.api.WxMaService;
4+
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceHttpClientImpl;
5+
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
6+
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceJoddHttpImpl;
7+
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceOkHttpImpl;
8+
import cn.binarywang.wx.miniapp.config.WxMaConfig;
9+
import com.binarywang.spring.starter.wxjava.miniapp.enums.HttpClientType;
10+
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaProperties;
11+
import lombok.AllArgsConstructor;
12+
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
13+
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
14+
import org.springframework.context.annotation.Bean;
15+
import org.springframework.context.annotation.Configuration;
16+
17+
/**
18+
* 微信小程序平台相关服务自动注册.
19+
*
20+
* @author someone TaoYu
21+
*/
22+
@Configuration
23+
@AllArgsConstructor
24+
public class WxMaServiceAutoConfiguration {
25+
26+
private final WxMaProperties wxMaProperties;
27+
28+
/**
29+
* 小程序service.
30+
*
31+
* @return 小程序service
32+
*/
33+
@Bean
34+
@ConditionalOnMissingBean(WxMaService.class)
35+
@ConditionalOnBean(WxMaConfig.class)
36+
public WxMaService wxMaService(WxMaConfig wxMaConfig) {
37+
HttpClientType httpClientType = wxMaProperties.getConfigStorage().getHttpClientType();
38+
WxMaService wxMaService;
39+
switch (httpClientType) {
40+
case OkHttp:
41+
wxMaService = new WxMaServiceOkHttpImpl();
42+
break;
43+
case JoddHttp:
44+
wxMaService = new WxMaServiceJoddHttpImpl();
45+
break;
46+
case HttpClient:
47+
wxMaService = new WxMaServiceHttpClientImpl();
48+
break;
49+
default:
50+
wxMaService = new WxMaServiceImpl();
51+
break;
52+
}
53+
wxMaService.setWxMaConfig(wxMaConfig);
54+
return wxMaService;
55+
}
56+
}

0 commit comments

Comments
 (0)