Merge branch 'release/1.10.0'

This commit is contained in:
Sutra Zhou 2021-08-16 19:18:43 +08:00
commit 47da1be839
15 changed files with 434 additions and 156 deletions

23
maven-version-rules.xml Normal file
View File

@ -0,0 +1,23 @@
<ruleset comparisonMethod="maven"
xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0
http://mojo.codehaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
<ignoreVersions>
<ignoreVersion type="regex">.*(-|\.)(alpha|Alpha|ALPHA|beta|Beta|BETA|rc|RC).*</ignoreVersion>
</ignoreVersions>
<rules>
<rule groupId="javax.servlet" comparisonMethod="maven">
<ignoreVersions>
<ignoreVersion type="regex">.*-alpha[\.\-].*</ignoreVersion>
<ignoreVersion type="regex">.*-b[0-9]+</ignoreVersion>
</ignoreVersions>
</rule>
<rule groupId="javax.xml" comparisonMethod="maven">
<ignoreVersions>
<ignoreVersion type="regex">.*-b.*</ignoreVersion>
</ignoreVersions>
</rule>
</rules>
</ruleset>

161
pom.xml
View File

@ -2,9 +2,14 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.oxerr</groupId>
<artifactId>oxerr-parent</artifactId>
<version>1.1.0</version>
</parent>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j</artifactId> <artifactId>weixin4j</artifactId>
<version>1.9.1</version> <version>1.10.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>weixin4j</name> <name>weixin4j</name>
<url>https://github.com/foxinmy/weixin4j</url> <url>https://github.com/foxinmy/weixin4j</url>
@ -19,7 +24,7 @@
</license> </license>
</licenses> </licenses>
<scm> <scm>
<url>https://github.com/foxinmy/weixin4j</url> <url>https://github.com/foxinmy/weixin4j/tree/master</url>
<connection>scm:git:git://github.com/foxinmy/weixin4j.git</connection> <connection>scm:git:git://github.com/foxinmy/weixin4j.git</connection>
<developerConnection>scm:git:git@github.com:foxinmy/weixin4j.git</developerConnection> <developerConnection>scm:git:git@github.com:foxinmy/weixin4j.git</developerConnection>
<tag>HEAD</tag> <tag>HEAD</tag>
@ -48,29 +53,18 @@
<module>weixin4j-serverX</module> <module>weixin4j-serverX</module>
<module>weixin4j-pay</module> <module>weixin4j-pay</module>
<module>weixin4j-example</module> <module>weixin4j-example</module>
<module>weixin4j-coverage</module>
</modules> </modules>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.6</maven.compiler.source> <maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target> <maven.compiler.target>1.6</maven.compiler.target>
<fastjson.version>1.2.31</fastjson.version> <locales>zh_CN</locales>
</properties> </properties>
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration> <configuration>
<encoding>${project.build.sourceEncoding}</encoding> <encoding>${project.build.sourceEncoding}</encoding>
<!-- 过滤证书文件 --> <!-- 过滤证书文件 -->
@ -83,35 +77,29 @@
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>versions-maven-plugin</artifactId>
<version>2.5</version> <configuration>
<executions> <rulesUri>file:///${session.executionRootDirectory}/maven-version-rules.xml</rulesUri>
<execution> </configuration>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classesDirectory>target/classes</classesDirectory>
<excludes>
<exclude>*.properties</exclude>
<exclude>*.xml</exclude>
<exclude>*.txt</exclude>
<exclude>**/*.md</exclude>
</excludes>
<archive>
<addMavenDescriptor>true</addMavenDescriptor>
</archive>
<useDefaultManifestFile>true</useDefaultManifestFile>
</configuration>
</execution>
</executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>com.amashchenko.maven.plugin</groupId> <groupId>org.jacoco</groupId>
<artifactId>gitflow-maven-plugin</artifactId> <artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
<pluginManagement> <pluginManagement>
@ -149,19 +137,11 @@
</executions> </executions>
<configuration> <configuration>
<show>public</show> <show>public</show>
<charset>${project.build.sourceEncoding}</charset>
<encoding>${project.build.sourceEncoding}</encoding>
<docencoding>${project.build.sourceEncoding}</docencoding>
<links> <links>
<link>http://docs.oracle.com/javase/7/docs/api</link> <link>http://docs.oracle.com/javase/7/docs/api</link>
</links> </links>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
@ -175,19 +155,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.9.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
@ -208,9 +175,14 @@
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>com.amashchenko.maven.plugin</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>gitflow-maven-plugin</artifactId> <artifactId>findbugs-maven-plugin</artifactId>
<version>1.15.0</version> <version>3.0.5</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
</plugin> </plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
@ -307,17 +279,72 @@
</profiles> </profiles>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<dependency> <dependency>
<groupId>org.bouncycastle</groupId> <groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId> <artifactId>bcprov-jdk16</artifactId>
<version>1.46</version> <version>1.46</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.3.9</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.3.9</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.78</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.1</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.67.Final</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.13.1</version> <version>4.13.2</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.6.3</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<distributionManagement> <distributionManagement>

View File

@ -5,13 +5,43 @@
<parent> <parent>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j</artifactId> <artifactId>weixin4j</artifactId>
<version>1.9.1</version> <version>1.10.0</version>
</parent> </parent>
<artifactId>weixin4j-base</artifactId> <artifactId>weixin4j-base</artifactId>
<name>weixin4j-base</name> <name>weixin4j-base</name>
<description>微信开发基础工程</description> <description>微信开发基础工程</description>
<url>https://github.com/foxinmy/weixin4j/tree/master/weixin4j-base</url> <url>https://github.com/foxinmy/weixin4j/tree/master/weixin4j-base</url>
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
<build> <build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classesDirectory>target/classes</classesDirectory>
<excludes>
<exclude>*.properties</exclude>
<exclude>*.xml</exclude>
<exclude>*.txt</exclude>
<exclude>**/*.md</exclude>
</excludes>
<archive>
<addMavenDescriptor>true</addMavenDescriptor>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources> <resources>
<resource> <resource>
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
@ -23,7 +53,6 @@
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
@ -32,25 +61,22 @@
<dependency> <dependency>
<groupId>commons-httpclient</groupId> <groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId> <artifactId>commons-httpclient</artifactId>
<version>3.0</version> <version>3.1</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
<version>4.3.6</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-all</artifactId> <artifactId>netty-all</artifactId>
<version>4.1.42.Final</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.squareup.okhttp3</groupId> <groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId> <artifactId>okhttp</artifactId>
<version>3.4.1</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
@ -62,7 +88,6 @@
<dependency> <dependency>
<groupId>redis.clients</groupId> <groupId>redis.clients</groupId>
<artifactId>jedis</artifactId> <artifactId>jedis</artifactId>
<version>2.8.1</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
@ -79,7 +104,6 @@
<dependency> <dependency>
<groupId>javax.xml.bind</groupId> <groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId> <artifactId>jaxb-api</artifactId>
<version>2.2.11</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -8,7 +8,7 @@ import com.foxinmy.weixin4j.util.SerializationUtils;
import redis.clients.jedis.Jedis; import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig; import redis.clients.jedis.JedisPoolConfig;
import redis.clients.util.Pool; import redis.clients.jedis.util.Pool;
/** /**
* 用Redis保存缓存对象(推荐使用) * 用Redis保存缓存对象(推荐使用)

77
weixin4j-coverage/pom.xml Normal file
View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.foxinmy</groupId>
<artifactId>weixin4j</artifactId>
<version>1.10.0</version>
</parent>
<artifactId>weixin4j-coverage</artifactId>
<name>weixin4j-coverage</name>
<packaging>pom</packaging>
<description>Compute aggregated test code coverage.</description>
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>weixin4j-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>weixin4j-mp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>weixin4j-qy</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>weixin4j-wxa</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>weixin4j-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>weixin4j-serverX</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>weixin4j-pay</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<report>report-aggregate</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j</artifactId> <artifactId>weixin4j</artifactId>
<version>1.9.1</version> <version>1.10.0</version>
</parent> </parent>
<packaging>war</packaging> <packaging>war</packaging>
<artifactId>weixin4j-example</artifactId> <artifactId>weixin4j-example</artifactId>
@ -76,7 +76,6 @@
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId> <artifactId>spring-webmvc</artifactId>
<version>4.1.3.RELEASE</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
@ -87,7 +86,6 @@
<dependency> <dependency>
<groupId>javax.servlet.jsp</groupId> <groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId> <artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -103,7 +101,6 @@
<dependency> <dependency>
<groupId>com.squareup.okhttp3</groupId> <groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId> <artifactId>okhttp</artifactId>
<version>3.3.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -5,18 +5,46 @@
<parent> <parent>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j</artifactId> <artifactId>weixin4j</artifactId>
<version>1.9.1</version> <version>1.10.0</version>
</parent> </parent>
<artifactId>weixin4j-mp</artifactId> <artifactId>weixin4j-mp</artifactId>
<name>weixin4j-mp</name> <name>weixin4j-mp</name>
<url>https://github.com/foxinmy/weixin4j/tree/master/weixin4j-mp</url> <url>https://github.com/foxinmy/weixin4j/tree/master/weixin4j-mp</url>
<description>微信公众平台API</description> <description>微信公众平台API</description>
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classesDirectory>target/classes</classesDirectory>
<excludes>
<exclude>*.properties</exclude>
<exclude>*.xml</exclude>
<exclude>*.txt</exclude>
<exclude>**/*.md</exclude>
</excludes>
<archive>
<addMavenDescriptor>true</addMavenDescriptor>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
<dependencies> <dependencies>
@ -29,7 +57,6 @@
<dependency> <dependency>
<groupId>javax.xml.bind</groupId> <groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId> <artifactId>jaxb-api</artifactId>
<version>2.2.11</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -1,53 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<parent> xsi:schemaLocation="
<artifactId>weixin4j</artifactId> http://maven.apache.org/POM/4.0.0
<groupId>com.foxinmy</groupId> http://maven.apache.org/xsd/maven-4.0.0.xsd">
<version>1.9.1</version> <parent>
</parent> <artifactId>weixin4j</artifactId>
<modelVersion>4.0.0</modelVersion> <groupId>com.foxinmy</groupId>
<name>weixin4j-pay</name> <version>1.10.0</version>
<artifactId>weixin4j-pay</artifactId> </parent>
<url>https://github.com/foxinmy/weixin4j/tree/master/weixin4j-pay</url> <modelVersion>4.0.0</modelVersion>
<description>微信支付商户平台API</description> <name>weixin4j-pay</name>
<developers> <artifactId>weixin4j-pay</artifactId>
<developer> <url>https://github.com/foxinmy/weixin4j/tree/master/weixin4j-pay</url>
<id>kit-lee</id> <description>微信支付商户平台API</description>
<name>Kit lee</name> <properties>
<email>ryuji.cn@gmail.com</email> <maven.test.skip>true</maven.test.skip>
<url>https://github.com/kit-lee</url> </properties>
<properties> <developers>
<contact>kit_21cn@21cn.com</contact> <developer>
<forkRepo>https://github.com/kit-lee/weixin4j</forkRepo> <id>kit-lee</id>
</properties> <name>Kit lee</name>
</developer> <email>ryuji.cn@gmail.com</email>
</developers> <url>https://github.com/kit-lee</url>
<build> <properties>
<plugins> <contact>kit_21cn@21cn.com</contact>
<plugin> <forkRepo>https://github.com/kit-lee/weixin4j</forkRepo>
<groupId>org.apache.maven.plugins</groupId> </properties>
<artifactId>maven-assembly-plugin</artifactId> </developer>
</plugin> </developers>
</plugins> <build>
</build> <plugins>
<dependencies> <plugin>
<dependency> <groupId>org.apache.maven.plugins</groupId>
<groupId>com.foxinmy</groupId> <artifactId>maven-assembly-plugin</artifactId>
<artifactId>weixin4j-base</artifactId> </plugin>
<version>${project.version}</version> <plugin>
</dependency> <groupId>org.apache.maven.plugins</groupId>
<!-- 兼容 JDK 9+ 后的maven环境编译 --> <artifactId>maven-jar-plugin</artifactId>
<dependency> <executions>
<groupId>javax.xml.bind</groupId> <execution>
<artifactId>jaxb-api</artifactId> <id>default-jar</id>
<version>2.2.11</version> <phase>package</phase>
<scope>provided</scope> <goals>
</dependency> <goal>jar</goal>
<dependency> </goals>
<groupId>junit</groupId> <configuration>
<artifactId>junit</artifactId> <classesDirectory>target/classes</classesDirectory>
</dependency> <excludes>
</dependencies> <exclude>*.properties</exclude>
<exclude>*.xml</exclude>
<exclude>*.txt</exclude>
<exclude>**/*.md</exclude>
</excludes>
<archive>
<addMavenDescriptor>true</addMavenDescriptor>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.foxinmy</groupId>
<artifactId>weixin4j-base</artifactId>
<version>${project.version}</version>
</dependency>
<!-- 兼容 JDK 9+ 后的maven环境编译 -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
</project> </project>

View File

@ -5,18 +5,46 @@
<parent> <parent>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j</artifactId> <artifactId>weixin4j</artifactId>
<version>1.9.1</version> <version>1.10.0</version>
</parent> </parent>
<artifactId>weixin4j-qy</artifactId> <artifactId>weixin4j-qy</artifactId>
<name>weixin4j-qy</name> <name>weixin4j-qy</name>
<url>https://github.com/foxinmy/weixin4j/tree/master/weixin4j-qy</url> <url>https://github.com/foxinmy/weixin4j/tree/master/weixin4j-qy</url>
<description>微信企业号API</description> <description>微信企业号API</description>
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classesDirectory>target/classes</classesDirectory>
<excludes>
<exclude>*.properties</exclude>
<exclude>*.xml</exclude>
<exclude>*.txt</exclude>
<exclude>**/*.md</exclude>
</excludes>
<archive>
<addMavenDescriptor>true</addMavenDescriptor>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
<dependencies> <dependencies>

View File

@ -6,12 +6,15 @@
<parent> <parent>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j</artifactId> <artifactId>weixin4j</artifactId>
<version>1.9.1</version> <version>1.10.0</version>
</parent> </parent>
<artifactId>weixin4j-server</artifactId> <artifactId>weixin4j-server</artifactId>
<name>weixin4j-server</name> <name>weixin4j-server</name>
<url>https://github.com/foxinmy/weixin4j/tree/master/weixin4j-server</url> <url>https://github.com/foxinmy/weixin4j/tree/master/weixin4j-server</url>
<description>微信消息netty服务器</description> <description>微信消息netty服务器</description>
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
@ -27,13 +30,11 @@
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency> </dependency>
<!-- 兼容 JDK 9+ 后的maven环境编译 --> <!-- 兼容 JDK 9+ 后的maven环境编译 -->
<dependency> <dependency>
<groupId>javax.xml.bind</groupId> <groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId> <artifactId>jaxb-api</artifactId>
<version>2.2.11</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -43,13 +44,11 @@
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
<version>4.3.6</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId> <artifactId>spring-context</artifactId>
<version>4.2.0.RELEASE</version>
<optional>true</optional> <optional>true</optional>
<exclusions> <exclusions>
<exclusion> <exclusion>

View File

@ -6,15 +6,12 @@
<parent> <parent>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j</artifactId> <artifactId>weixin4j</artifactId>
<version>1.9.1</version> <version>1.10.0</version>
</parent> </parent>
<artifactId>weixin4j-serverX</artifactId> <artifactId>weixin4j-serverX</artifactId>
<name>weixin4j-serverX</name> <name>weixin4j-serverX</name>
<url>https://github.com/foxinmy/weixin4j/tree/master/weixin4j-serverX</url> <url>https://github.com/foxinmy/weixin4j/tree/master/weixin4j-serverX</url>
<description>微信消息接入服务(spring mvc实现)</description> <description>微信消息接入服务(spring mvc实现)</description>
<properties>
<spring.version>4.2.0.RELEASE</spring.version>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
@ -23,13 +20,11 @@
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId> <artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency> </dependency>
<!-- 兼容 JDK 9+ 后的maven环境编译 --> <!-- 兼容 JDK 9+ 后的maven环境编译 -->
<dependency> <dependency>
<groupId>javax.xml.bind</groupId> <groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId> <artifactId>jaxb-api</artifactId>
<version>2.2.11</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -47,7 +42,6 @@
<groupId>javax.servlet.jsp</groupId> <groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId> <artifactId>jsp-api</artifactId>
<scope>provided</scope> <scope>provided</scope>
<version>2.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
<developers> <developers>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j</artifactId> <artifactId>weixin4j</artifactId>
<version>1.9.1</version> <version>1.10.0</version>
</parent> </parent>
<artifactId>weixin4j-wxa</artifactId> <artifactId>weixin4j-wxa</artifactId>
<name>weixin4j-wxa</name> <name>weixin4j-wxa</name>
@ -21,19 +21,18 @@
</build> </build>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.foxinmy</groupId> <groupId>${project.groupId}</groupId>
<artifactId>weixin4j-base</artifactId> <artifactId>weixin4j-base</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.foxinmy</groupId> <groupId>${project.groupId}</groupId>
<artifactId>weixin4j-mp</artifactId> <artifactId>weixin4j-mp</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-codec</groupId> <groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId> <artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
@ -42,7 +41,6 @@
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId> <artifactId>logback-core</artifactId>
<version>1.1.8</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -15,12 +15,12 @@ import com.alibaba.fastjson.JSONObject;
*/ */
public class WXBizDataCrypt { public class WXBizDataCrypt {
private final String appid; private final String appId;
private final String sessionKey; private final String sessionKey;
public WXBizDataCrypt(String appid, String sessionKey) { public WXBizDataCrypt(String appId, String sessionKey) {
this.appid = appid; this.appId = appId;
this.sessionKey = sessionKey; this.sessionKey = sessionKey;
} }
@ -40,8 +40,8 @@ public class WXBizDataCrypt {
final String decryptedText = new String(decryptedBytes, Charset.forName("UTF-8")); final String decryptedText = new String(decryptedBytes, Charset.forName("UTF-8"));
final JSONObject decrypted = JSON.parseObject(decryptedText); final JSONObject decrypted = JSON.parseObject(decryptedText);
final String appId = decrypted.getJSONObject("watermark").getString("appid"); final String watermarkAppId = decrypted.getJSONObject("watermark").getString("appid");
if (!appId.equals(this.appid)) { if (!watermarkAppId.equals(this.appId)) {
throw new IllegalArgumentException("Invalid Buffer"); throw new IllegalArgumentException("Invalid Buffer");
} }

View File

@ -0,0 +1,33 @@
## 欢迎来到 weixin4j-wxa
微信小程序 API 支持
### 如何使用
```java
var appId = "YOUR APP ID";
var appSecret = "YOUR APP SECRET";
var wxAccount = new WeixinAccount(appId, appSecret);
var wxa = new WeixinAppFacade(wxAccount);
var jsCode = request.getParameter("jsCode");
var session = wxa.getLoginApi().jscode2session(jsCode);
```
*更多 API 见 [WeixinAppFacade JavaDoc](apidocs/index.html?com/foxinmy/weixin4j/wxa/WeixinAppFacade.html)。*
### 解密数据
客户端 API
[`wx.getUserInfo(Object object)`](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html)
[`wx.getUserProfile(Object object)`](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html)
等请求后得到的加密数据,可以通过下面的方法来解密。
客户端将获得的加密数据发往业务服务器,业务服务器收到加密数据后,
使用[登录凭证校验 API](apidocs/index.html?com/foxinmy/weixin4j/wxa/api/LoginApi.html)
获得的 `sessionKey` 解密并进行后续操作:
```java
var encryptedData = request.getParameter("encryptedData");
var iv = request.getParameter("iv");
var sessionKey = session.getSessionKey();
var wxBizDataCrypt = new WXBizDataCrypt(appId, sessionKey);
var decryptedData = wxBizDataCrypt.decryptData(encryptedData, iv);
```

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/DECORATION/1.8.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.8.0 https://maven.apache.org/xsd/decoration-1.8.0.xsd"
name="Maven">
<bannerLeft>
<name>微信小程序</name>
</bannerLeft>
<bannerRight>
<name>微信小程序</name>
<title>微信小程序</title>
<src>data:image/svg+xml;charset=UTF-8,%3csvg width='36' height='36' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M27.4362985 16.6454925c-.7072239 1.1607165-1.8835821 2.0505075-3.2927761 2.4601791-.0354627.0102687-.0705672.0212538-.1062687.0309254-.2176716.0618508-.4409552.0997015-.6622089.0997015-.9763582 0-1.5276418-.6594627-1.2315224-1.4730746.216597-.5949851.785194-1.097194 1.4791642-1.3296717 1.0755821-.3922388 1.8271044-1.2868059 1.8271044-2.3277612 0-1.4026268-1.3645373-2.5397014-3.0476417-2.5397014-1.6832239 0-3.0476418 1.1370746-3.0476418 2.5397014v7.788418c0 1.8730746-1.0852538 3.515582-2.709015 4.4445373-.8851343.506388-1.9277612.8040597-3.0475224.8040597-3.1743283 0-5.75665667-2.3545075-5.75665667-5.248597 0-.9211941.26340299-1.7863881.72238806-2.5397015.71032836-1.1658508 1.89397011-2.0586269 3.31164181-2.4656717.001194-.0003582.0022686-.0007164.0034627-.0010746.2390447-.0743881.4869253-.1157015.7313433-.1157015.9806567 0 1.5345671.6625672 1.2371343 1.4797612-.2015523.553791-.7443582 1.0306866-1.377194 1.2844179-.0755821.025194-.1491344.0534925-.2217314.0833433-1.0052537.4150448-1.6980298 1.2762985-1.6980298 2.2746269 0 1.4026268 1.3644179 2.539582 3.0476417 2.539582 1.6831045 0 3.0475224-1.1369552 3.0475224-2.539582v-7.788418c0-1.873194 1.0851344-3.515582 2.709015-4.44465667.8851343-.50638806 1.9277612-.8040597 3.0476418-.8040597 3.1742089 0 5.7566567 2.35450747 5.7566567 5.24871637 0 .9210747-.2635224 1.7863881-.7225075 2.5397015M18 2C9.16346269 2 2 9.16346269 2 18c0 8.8365373 7.16346269 16 16 16 8.8365373 0 16-7.1634627 16-16 0-8.83653731-7.1634627-16-16-16' fill='%2307C160' fill-rule='evenodd'/%3e%3c/svg%3e</src>
<href>https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/backend-api.html</href>
</bannerRight>
<body>
<links>
<item name="微信官方文档 - 小程序 - 服务端 API"
href="https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/backend-api.html" />
</links>
</body>
</project>