Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
db11c2a
Merge pull request #1 from chanjarster/develop
tianmu Dec 23, 2015
fa55bf6
Merge remote-tracking branch 'upstream/develop' into develop
tianmu Dec 25, 2015
b77e771
Merge pull request #1 from fxdfxq/patch-1
fxdfxq Mar 21, 2016
ae50576
Update WxMpService.java
fxdfxq Mar 25, 2016
ccdbef3
Update WxMpServiceImpl.java
fxdfxq Mar 25, 2016
d081749
Update WxMpServiceImpl.java
fxdfxq Mar 25, 2016
52e9b67
修复命名错误。data是datum的复数,datas是错误写法
mgcnrx11 Apr 24, 2016
f6c24ac
微信个性化菜单接口group_id改为tag_id
mgcnrx11 May 14, 2016
a6b8c40
Merge pull request #2 from chanjarster/develop
tianmu May 25, 2016
902b689
群发接口响应 增加msgDataId字段 用于图文分析
kareanyi Jun 1, 2016
58ad7b7
Merge pull request #1 from kareanyi/develop
binarywang Jun 1, 2016
83e443b
消息群发的预览接口
kareanyi Jun 1, 2016
46b3eba
修改groupId,修复Pom文件,同步README.md文件
binarywang Jun 1, 2016
c0f1632
Merge pull request #2 from kareanyi/develop
binarywang Jun 1, 2016
ba54ff5
上传图文消息内的图片获取URL
kareanyi Jun 1, 2016
1b4293c
Merge pull request #3 from kareanyi/develop
binarywang Jun 1, 2016
a6fecf5
disable doclint for java8
binarywang Jun 1, 2016
1405734
remove unused imports
binarywang Jun 2, 2016
fb3a093
fix weird assignment statement
binarywang Jun 2, 2016
dca8e30
add serialVersionUID for the classes which implement Serializable int…
binarywang Jun 2, 2016
5349da9
修改了部分接口字符串拼接的模式,从 + 改为StringBuffer
tianmu Jun 7, 2016
7057b8a
为WxError加入builder模式支持
binarywang Jun 16, 2016
d64f502
Merge branch 'tianmu' into develop
binarywang Jun 18, 2016
88a7ac3
Merge branch 'wxMenuRule' into develop
binarywang Jun 18, 2016
e492e5a
Merge branch 'fix_data_typo' into develop
binarywang Jun 18, 2016
7a816cf
Merge branch 'fxdfxq-master' into develop
binarywang Jun 18, 2016
af2f122
行业相关api
kareanyi Jun 19, 2016
f631df3
修复javadoc格式
binarywang Jun 20, 2016
1e6cf09
Update README.md
binarywang Jun 20, 2016
c1bbd72
Update README.md
binarywang Jun 20, 2016
4cce424
Update README.md
binarywang Jun 20, 2016
e1ade46
add missing @Override
binarywang Jun 20, 2016
0b2f443
add missing ‘this’
binarywang Jun 20, 2016
7a68fa6
remove redundant specification of type arguments
binarywang Jun 20, 2016
cc300b9
qrCodePictureUrl 返回网址过长,使用短网址进行压缩
binarywang Jun 20, 2016
d90ef7f
add missing ‘this.’ and @Override
binarywang Jun 20, 2016
e34f6de
add missing ‘this’
binarywang Jun 20, 2016
5358d68
规范部分javadoc
binarywang Jun 20, 2016
bc22b03
添加换取二维码图片url地址的重构方法(可以选择是否生成压缩的网址)
binarywang Jun 21, 2016
13d76c1
修复重构素材上传处理代码
binarywang Jun 24, 2016
ed80cec
替换以file.api.weixin.qq.com域名下的api为api.weixin.qq.com,并使用https
binarywang Jun 30, 2016
7deb25b
单元测试代码优化
binarywang Jun 30, 2016
e579ef0
add spring demo initial
binarywang Jun 30, 2016
3170945
sync README.md
binarywang Jun 30, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 18 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
weixin-java-tools
# Weixin Java Tools
## 微信公众号/企业号开发Java SDK
## [![Build Status](https://travis-ci.org/binarywang/weixin-java-tools.svg?branch=develop)](https://travis-ci.org/binarywang/weixin-java-tools) ![Maven Central](https://img.shields.io/maven-central/v/com.github.binarywang/weixin-java-parent.svg) <a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=078f7a153d243853e24cf2b542e7a6ccbf2a592bc138080f84d11297f736ec46"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="weixin-java-tools" title="weixin-java-tools"></a>

[![Build Status](https://travis-ci.org/chanjarster/weixin-java-tools.svg?branch=develop)](https://travis-ci.org/chanjarster/weixin-java-tools)
![Maven Central](https://img.shields.io/maven-central/v/me.chanjar/weixin-java-parent.svg)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/chanjarster/weixin-java-tools?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
### 声明:本项目基于chanjarster/weixin-java-tools,由于原作者长期没有维护,故单独维护和发布,且发布到maven上的groupId也会不同。
#### 最新更新:1.3.4版发布!!! on 2016-06-01

===========

* 群/聊天室:请点击上方的GITTER按钮
* 本项目的发布周期:本人子2015年6月开始进入到了一个非常忙碌的状态,且公司目前也没有开发微信相关的项目,因此本项目的维护基本靠“等”。所以靠人不如靠自己,提交pull request吧。
### 详细开发文档请看 [wiki](https://github.com/chanjarster/weixin-java-tools/wiki)。

===========
## 使用开发交流工具:
* QQ群:343954419 <a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=078f7a153d243853e24cf2b542e7a6ccbf2a592bc138080f84d11297f736ec46"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="weixin-java-tools" title="weixin-java-tools"></a>
* 微信群: 因二维码有时间限制,如有想加入微信群的,请入QQ群后咨询获取最新入群二维码。

===========

微信公众号、企业号Java SDK。

详细文档请看 [wiki](https://github.com/chanjarster/weixin-java-tools/wiki)。
## 发布周期
暂定为每月发布一次,月初或月底发布新版本,遇到重大问题需修复会及时提交新版本,欢迎大家随时提交Pull Request。

## Quick Start

如果要开发公众号(订阅号、服务号)应用,在你的maven项目中添加:

```xml
<dependency>
<groupId>me.chanjar</groupId>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-mp</artifactId>
<version>1.3.3</version>
<version>1.3.4</version>
</dependency>
```

如果要开发企业号应用,在你的maven项目中添加:

```xml
<dependency>
<groupId>me.chanjar</groupId>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-cp</artifactId>
<version>1.3.3</version>
<version>1.3.4</version>
</dependency>
```

Expand All @@ -51,14 +53,8 @@ weixin-java-tools
</repositories>
```

## 升级指南

* [1.0.3升级指南](https://github.com/chanjarster/weixin-java-tools/wiki/1_0_3升级指南)
* [1.1.0升级指南](https://github.com/chanjarster/weixin-java-tools/wiki/1_1_0升级指南)
* [1.1.1升级指南](https://github.com/chanjarster/weixin-java-tools/wiki/1_1_1升级指南)

## 关于Pull Request

非常欢迎和感谢对本项目发起Pull Request的同学,不过本项目基于[git flow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow)开发流程,因此在发起Pull Request的时候请选择develop分支。

且本项目代码风格是用2个空格代表一个tab,因此在发起PR时注意一下,否则很容易发生在IDE格式化代码后与原代码产生大量diff,这样我在阅读PR的时候就很困难。
且本项目代码风格是用2个空格代表一个tab,因此在发起PR时注意一下,否则很容易发生在IDE格式化代码后与原代码产生大量diff,这样我在阅读PR的时候就很困难。
28 changes: 22 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>me.chanjar</groupId>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-parent</artifactId>
<version>1.3.4-SNAPSHOT</version>
<version>1.3.5-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WeiXin Java Tools - Parent</name>
<description>微信公众号、企业号上级POM</description>
<url>https://github.com/chanjarster/weixin-java-tools</url>
<url>https://github.com/binarywang/weixin-java-tools</url>

<licenses>
<license>
Expand All @@ -23,18 +23,23 @@
<name>Daniel Qian</name>
<email>chanjarster@gmail.com</email>
</developer>
<developer>
<name>Binary Wang</name>
<email>binarywang@gmail.com</email>
</developer>
</developers>

<scm>
<connection>scm:git:https://github.com/chanjarster/weixin-java-tools.git</connection>
<developerConnection>scm:git:git@github.com:chanjarster/weixin-java-tools.git</developerConnection>
<url>https://github.com/chanjarster/weixin-java-tools</url>
<connection>scm:git:https://github.com/binarywang/weixin-java-tools.git</connection>
<developerConnection>scm:git:git@github.com:binarywang/weixin-java-tools.git</developerConnection>
<url>https://github.com/binarywang/weixin-java-tools</url>
</scm>

<modules>
<module>weixin-java-common</module>
<module>weixin-java-cp</module>
<module>weixin-java-mp</module>
<module>spring-demo</module>
</modules>

<properties>
Expand Down Expand Up @@ -144,6 +149,16 @@
</distributionManagement>

<profiles>
<profile>
<id>doclint-java8-disable</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<properties>
<javadoc.opts>-Xdoclint:none</javadoc.opts>
</properties>
</profile>

<profile>
<id>release</id>
<build>
Expand Down Expand Up @@ -174,6 +189,7 @@
</execution>
</executions>
<configuration>
<additionalparam>${javadoc.opts}</additionalparam>
<charset>UTF-8</charset>
<locale>zh_CN</locale>
</configuration>
Expand Down
25 changes: 25 additions & 0 deletions spring-demo/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<project
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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-parent</artifactId>
<version>1.3.5-SNAPSHOT</version>
</parent>
<artifactId>spring-demo</artifactId>
<packaging>war</packaging>
<name>WeiXin Java Tools - demo with spring</name>
<description>spring demo</description>
<url>https://github.com/binarywang/weixin-java-tools</url>

<dependencies>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-common</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

</project>
55 changes: 55 additions & 0 deletions spring-demo/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>api</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/v1/admin/*</url-pattern>
</filter-mapping>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener>
<servlet>
<description>spring mvc servlet</description>
<servlet-name>springMvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-servlet-common.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springMvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>
9 changes: 2 additions & 7 deletions weixin-java-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>me.chanjar</groupId>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-parent</artifactId>
<version>1.3.4-SNAPSHOT</version>
<version>1.3.5-SNAPSHOT</version>
</parent>

<artifactId>weixin-java-common</artifactId>
Expand All @@ -27,31 +27,26 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>9.3.0.M0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>9.3.0.M0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.Serializable;

public class WxAccessToken implements Serializable {
private static final long serialVersionUID = 8709719312922168909L;

private String accessToken;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
*/
public class WxCardApiSignature implements Serializable {

private static final long serialVersionUID = 158176707226975979L;

private String appId;

private String cardId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* jspai signature
*/
public class WxJsapiSignature implements Serializable {
private static final long serialVersionUID = -1116808193154384804L;

private String appid;

private String noncestr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
public class WxMenu implements Serializable {

private static final long serialVersionUID = -7083914585539687746L;

private List<WxMenuButton> buttons = new ArrayList<WxMenuButton>();

private WxMenuRule matchRule;
Expand Down Expand Up @@ -129,20 +131,20 @@ public String toString() {
}

public static class WxMenuRule {
private String groupId;
private String tagId;
private String sex;
private String country;
private String province;
private String city;
private String clientPlatformType;
private String language;

public String getGroupId() {
return groupId;
public String getTagId() {
return tagId;
}

public void setGroupId(String groupId) {
this.groupId = groupId;
public void setTagId(String tagId) {
this.tagId = tagId;
}

public String getSex() {
Expand Down Expand Up @@ -196,7 +198,7 @@ public void setLanguage(String language) {
@Override
public String toString() {
return "matchrule:{" +
"group_id='" + groupId + '\'' +
"tag_id='" + tagId + '\'' +
", sex='" + sex + '\'' +
", country" + country + '\'' +
", province" + province + '\'' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
import java.io.Serializable;

/**
* 微信错误码说明
* http://mp.weixin.qq.com/wiki/index.php?title=全局返回码说明
* 微信错误码说明,请阅读: <a href="http://mp.weixin.qq.com/wiki/10/6380dc743053a91c544ffd2b7c959166.html">全局返回码说明</a>
* @author Daniel Qian
*
*/
public class WxError implements Serializable {

private static final long serialVersionUID = 7869786563361406291L;

private int errorCode;

private String errorMsg;
Expand Down Expand Up @@ -52,4 +53,30 @@ public String toString() {
return "微信错误: errcode=" + errorCode + ", errmsg=" + errorMsg + "\njson:" + json;
}

public static Builder newBuilder(){
return new Builder();
}

public static class Builder{
private int errorCode;
private String errorMsg;

public Builder setErrorCode(int errorCode) {
this.errorCode = errorCode;
return this;
}

public Builder setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
return this;
}

public WxError build(){
WxError wxError = new WxError();
wxError.setErrorCode(this.errorCode);
wxError.setErrorMsg(this.errorMsg);
return wxError;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import java.io.Serializable;

public class WxMediaUploadResult implements Serializable {

private static final long serialVersionUID = 330834334738622341L;

private String type;
private String mediaId;
private String thumbMediaId;
Expand Down
Loading