Skip to content

Commit 23e4a32

Browse files
committed
微信企业号
1 parent d0ac1da commit 23e4a32

File tree

224 files changed

+8260
-377
lines changed

Some content is hidden

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

224 files changed

+8260
-377
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ target
1616
.project
1717
.classpath
1818

19-
src/test/resources/test-config.xml
2019
sw-pom.xml
2120
*.iml
21+
test-config.xml

src/test/resources/testng.xml

Lines changed: 0 additions & 35 deletions
This file was deleted.
File renamed without changes.

weixin-java-enterprise/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
weixin-java-tools
2+
===========
3+
4+
微信java开发工具集,本项目主要分为两大块:微信消息路由器、微信Java API
5+
6+
特性列表:
7+
8+
1. 不基于Servlet、和其他MVC框架,仅作为工具使用,提供更多的灵活性
9+
2. 详尽的单元测试代码,可以拿来当example用
10+
3. 详尽的javadoc
11+
4. access token过期自动刷新的功能
12+
5. 微信服务端繁忙自动重试的功能
13+
6. 提供微信错误信息的异常处理机制
14+
15+
16+
详细文档请看 [wiki](https://github.com/chanjarster/weixin-java-tools/wiki)
17+
18+
# Quickstart
19+
20+
在你的maven项目中添加:
21+
```xml
22+
<dependency>
23+
<groupId>me.chanjar</groupId>
24+
<artifactId>weixin-java-tools</artifactId>
25+
<version>1.0.2</version>
26+
</dependency>
27+
```
28+
29+
如果要使用``*-SNAPSHOT``版,则需要在你的``pom.xml``中添加这段:
30+
31+
```xml
32+
<repositories>
33+
<repository>
34+
<snapshots />
35+
<id>sonatype snapshots</id>
36+
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
37+
</repository>
38+
</repositories>
39+
```
40+
41+
## Hello World
42+
```java
43+
WxConfigStorage config = new WxInMemoryConfigStorage();
44+
config.setAppId(...); // 设置微信公众号的appid
45+
config.setSecret(...); // 设置微信公众号的app corpSecret
46+
config.setToken(...); // 设置微信公众号的token
47+
48+
WxServiceImpl wxService = new WxServiceImpl();
49+
wxService.setWxConfigStorage(config);
50+
51+
// 用户的openid在下面地址获得
52+
// https://mp.weixin.qq.com/debug/cgi-bin/apiinfo?t=index&type=用户管理&form=获取关注者列表接口%20/user/get
53+
String openId = ...;
54+
WxCustomMessage message = WxCustomMessage.TEXT().toUser(openId).content("Hello World").build();
55+
wxService.customMessageSend(message);
56+
```

weixin-java-enterprise/pom.xml

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
<?xml version="1.0"?>
2+
<project
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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>me.chanjar</groupId>
7+
<artifactId>weixin-java-enterprise-tools</artifactId>
8+
<version>1.0.3-SNAPSHOT</version>
9+
<name>WeiXin Java Enterprise Tools</name>
10+
<description>微信企业号Java SDK</description>
11+
<url>https://github.com/chanjarster/weixin-java-tools</url>
12+
13+
<licenses>
14+
<license>
15+
<name>The Apache License, Version 2.0</name>
16+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
17+
</license>
18+
</licenses>
19+
20+
<developers>
21+
<developer>
22+
<name>Daniel Qian</name>
23+
<email>chanjarster@gmail.com</email>
24+
</developer>
25+
</developers>
26+
27+
<scm>
28+
<connection>scm:git:https://github.com/chanjarster/weixin-java-tools.git</connection>
29+
<developerConnection>scm:git:git@github.com:chanjarster/weixin-java-tools.git</developerConnection>
30+
<url>https://github.com/chanjarster/weixin-java-tools</url>
31+
</scm>
32+
33+
<properties>
34+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
35+
<downloadJavadocs>true</downloadJavadocs>
36+
<downloadSources>true</downloadSources>
37+
<httpclient.version>4.3.5</httpclient.version>
38+
</properties>
39+
<dependencies>
40+
<dependency>
41+
<groupId>junit</groupId>
42+
<artifactId>junit</artifactId>
43+
<version>4.11</version>
44+
<scope>test</scope>
45+
</dependency>
46+
<dependency>
47+
<groupId>org.apache.httpcomponents</groupId>
48+
<artifactId>fluent-hc</artifactId>
49+
<version>${httpclient.version}</version>
50+
</dependency>
51+
<dependency>
52+
<groupId>org.apache.httpcomponents</groupId>
53+
<artifactId>httpmime</artifactId>
54+
<version>${httpclient.version}</version>
55+
</dependency>
56+
<dependency>
57+
<groupId>javax.xml.bind</groupId>
58+
<artifactId>jaxb-api</artifactId>
59+
<version>2.2.7</version>
60+
</dependency>
61+
<dependency>
62+
<groupId>com.sun.xml.bind</groupId>
63+
<artifactId>jaxb-impl</artifactId>
64+
<version>2.2.7</version>
65+
</dependency>
66+
<dependency>
67+
<groupId>org.apache.oltu.oauth2</groupId>
68+
<artifactId>org.apache.oltu.oauth2.client</artifactId>
69+
<version>1.0.0</version>
70+
</dependency>
71+
<dependency>
72+
<groupId>com.google.code.gson</groupId>
73+
<artifactId>gson</artifactId>
74+
<version>2.2.2</version>
75+
</dependency>
76+
<dependency>
77+
<groupId>org.testng</groupId>
78+
<artifactId>testng</artifactId>
79+
<version>6.8.7</version>
80+
<scope>test</scope>
81+
</dependency>
82+
<dependency>
83+
<groupId>org.mockito</groupId>
84+
<artifactId>mockito-all</artifactId>
85+
<version>1.9.5</version>
86+
<scope>test</scope>
87+
</dependency>
88+
<dependency>
89+
<groupId>com.google.inject</groupId>
90+
<artifactId>guice</artifactId>
91+
<version>3.0</version>
92+
<scope>test</scope>
93+
</dependency>
94+
<dependency>
95+
<groupId>org.apache.commons</groupId>
96+
<artifactId>commons-lang3</artifactId>
97+
<version>3.1</version>
98+
</dependency>
99+
<dependency>
100+
<groupId>commons-codec</groupId>
101+
<artifactId>commons-codec</artifactId>
102+
<version>1.9</version>
103+
</dependency>
104+
<dependency>
105+
<groupId>commons-io</groupId>
106+
<artifactId>commons-io</artifactId>
107+
<version>2.4</version>
108+
</dependency>
109+
<dependency>
110+
<groupId>org.eclipse.jetty</groupId>
111+
<artifactId>jetty-server</artifactId>
112+
<version>9.3.0.M0</version>
113+
<scope>test</scope>
114+
</dependency>
115+
<dependency>
116+
<groupId>org.eclipse.jetty</groupId>
117+
<artifactId>jetty-servlet</artifactId>
118+
<version>9.3.0.M0</version>
119+
<scope>test</scope>
120+
</dependency>
121+
</dependencies>
122+
123+
<distributionManagement>
124+
<snapshotRepository>
125+
<id>ossrh</id>
126+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
127+
</snapshotRepository>
128+
<repository>
129+
<id>ossrh</id>
130+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
131+
</repository>
132+
</distributionManagement>
133+
134+
<profiles>
135+
<profile>
136+
<id>release</id>
137+
<build>
138+
<plugins>
139+
<plugin>
140+
<groupId>org.apache.maven.plugins</groupId>
141+
<artifactId>maven-source-plugin</artifactId>
142+
<version>2.2.1</version>
143+
<executions>
144+
<execution>
145+
<id>attach-sources</id>
146+
<goals>
147+
<goal>jar-no-fork</goal>
148+
</goals>
149+
</execution>
150+
</executions>
151+
</plugin>
152+
<plugin>
153+
<groupId>org.apache.maven.plugins</groupId>
154+
<artifactId>maven-javadoc-plugin</artifactId>
155+
<version>2.9.1</version>
156+
<executions>
157+
<execution>
158+
<id>attach-javadocs</id>
159+
<goals>
160+
<goal>jar</goal>
161+
</goals>
162+
</execution>
163+
</executions>
164+
<configuration>
165+
<charset>UTF-8</charset>
166+
<locale>zh_CN</locale>
167+
</configuration>
168+
</plugin>
169+
<plugin>
170+
<groupId>org.apache.maven.plugins</groupId>
171+
<artifactId>maven-gpg-plugin</artifactId>
172+
<version>1.5</version>
173+
<executions>
174+
<execution>
175+
<id>sign-artifacts</id>
176+
<phase>verify</phase>
177+
<goals>
178+
<goal>sign</goal>
179+
</goals>
180+
</execution>
181+
</executions>
182+
</plugin>
183+
</plugins>
184+
</build>
185+
</profile>
186+
</profiles>
187+
188+
<build>
189+
<plugins>
190+
<plugin>
191+
<groupId>org.apache.maven.plugins</groupId>
192+
<artifactId>maven-surefire-plugin</artifactId>
193+
<version>2.17</version>
194+
<configuration>
195+
<suiteXmlFiles>
196+
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
197+
</suiteXmlFiles>
198+
</configuration>
199+
</plugin>
200+
<plugin>
201+
<groupId>org.sonatype.plugins</groupId>
202+
<artifactId>nexus-staging-maven-plugin</artifactId>
203+
<version>1.6.3</version>
204+
<extensions>true</extensions>
205+
<configuration>
206+
<serverId>ossrh</serverId>
207+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
208+
<autoReleaseAfterClose>false</autoReleaseAfterClose>
209+
</configuration>
210+
</plugin>
211+
<plugin>
212+
<groupId>org.apache.maven.plugins</groupId>
213+
<artifactId>maven-release-plugin</artifactId>
214+
<version>2.5</version>
215+
<configuration>
216+
<autoVersionSubmodules>true</autoVersionSubmodules>
217+
<useReleaseProfile>false</useReleaseProfile>
218+
<releaseProfiles>release</releaseProfiles>
219+
<goals>deploy</goals>
220+
</configuration>
221+
</plugin>
222+
</plugins>
223+
</build>
224+
225+
226+
</project>

0 commit comments

Comments
 (0)