mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-09-24 21:13:59 +08:00
Merge branch 'develop'
# Conflicts: # pom.xml # weixin-java-common/pom.xml # weixin-java-cp/pom.xml # weixin-java-mp/pom.xml
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>weixin-java-parent</artifactId>
|
||||
<version>1.3.4</version>
|
||||
<version>1.3.5</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>weixin-java-common</artifactId>
|
||||
@@ -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>
|
||||
|
@@ -5,6 +5,7 @@ import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class WxAccessToken implements Serializable {
|
||||
private static final long serialVersionUID = 8709719312922168909L;
|
||||
|
||||
private String accessToken;
|
||||
|
||||
|
@@ -10,6 +10,8 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class WxCardApiSignature implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 158176707226975979L;
|
||||
|
||||
private String appId;
|
||||
|
||||
private String cardId;
|
||||
|
@@ -6,6 +6,8 @@ import java.io.Serializable;
|
||||
* jspai signature
|
||||
*/
|
||||
public class WxJsapiSignature implements Serializable {
|
||||
private static final long serialVersionUID = -1116808193154384804L;
|
||||
|
||||
private String appid;
|
||||
|
||||
private String noncestr;
|
||||
|
@@ -16,6 +16,8 @@ import java.util.List;
|
||||
*/
|
||||
public class WxMenu implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -7083914585539687746L;
|
||||
|
||||
private List<WxMenuButton> buttons = new ArrayList<WxMenuButton>();
|
||||
|
||||
private WxMenuRule matchRule;
|
||||
@@ -129,7 +131,7 @@ public class WxMenu implements Serializable {
|
||||
}
|
||||
|
||||
public static class WxMenuRule {
|
||||
private String groupId;
|
||||
private String tagId;
|
||||
private String sex;
|
||||
private String country;
|
||||
private String province;
|
||||
@@ -137,12 +139,12 @@ public class WxMenu implements Serializable {
|
||||
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() {
|
||||
@@ -196,7 +198,7 @@ public class WxMenu implements Serializable {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "matchrule:{" +
|
||||
"group_id='" + groupId + '\'' +
|
||||
"tag_id='" + tagId + '\'' +
|
||||
", sex='" + sex + '\'' +
|
||||
", country" + country + '\'' +
|
||||
", province" + province + '\'' +
|
||||
|
@@ -5,13 +5,14 @@ import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
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;
|
||||
@@ -52,4 +53,30 @@ public class WxError implements Serializable {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -5,7 +5,8 @@ import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class WxMediaUploadResult implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 330834334738622341L;
|
||||
|
||||
private String type;
|
||||
private String mediaId;
|
||||
private String thumbMediaId;
|
||||
|
@@ -1,11 +1,10 @@
|
||||
package me.chanjar.weixin.common.util.crypto;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
|
||||
/**
|
||||
* Created by Daniel Qian on 14/10/19.
|
||||
*/
|
||||
|
@@ -83,7 +83,7 @@ public class WxCryptUtil {
|
||||
String encryptedXml = encrypt(genRandomStr(), plainText);
|
||||
|
||||
// 生成安全签名
|
||||
String timeStamp = timeStamp = Long.toString(System.currentTimeMillis() / 1000l);
|
||||
String timeStamp = Long.toString(System.currentTimeMillis() / 1000l);
|
||||
String nonce = genRandomStr();
|
||||
|
||||
try {
|
||||
|
@@ -5,7 +5,6 @@ import java.io.IOException;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
|
||||
|
@@ -62,7 +62,7 @@ public class WxMenuGsonAdapter implements JsonSerializer<WxMenu>, JsonDeserializ
|
||||
|
||||
protected JsonObject convertToJson(WxMenu.WxMenuRule menuRule){
|
||||
JsonObject matchRule = new JsonObject();
|
||||
matchRule.addProperty("group_id",menuRule.getGroupId());
|
||||
matchRule.addProperty("tag_id",menuRule.getTagId());
|
||||
matchRule.addProperty("sex",menuRule.getSex());
|
||||
matchRule.addProperty("country",menuRule.getCountry());
|
||||
matchRule.addProperty("province",menuRule.getProvince());
|
||||
|
@@ -1,19 +1,15 @@
|
||||
package me.chanjar.weixin.common.util.xml;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.converters.basic.DoubleConverter;
|
||||
import com.thoughtworks.xstream.converters.basic.FloatConverter;
|
||||
import com.thoughtworks.xstream.converters.basic.IntConverter;
|
||||
import com.thoughtworks.xstream.core.util.QuickWriter;
|
||||
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
|
||||
import com.thoughtworks.xstream.io.xml.PrettyPrintWriter;
|
||||
import com.thoughtworks.xstream.io.xml.XppDriver;
|
||||
import com.thoughtworks.xstream.security.NoTypePermission;
|
||||
import com.thoughtworks.xstream.security.NullPermission;
|
||||
import com.thoughtworks.xstream.security.PrimitiveTypePermission;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
public class XStreamInitializer {
|
||||
|
||||
public static XStream getInstance() {
|
||||
|
@@ -67,7 +67,7 @@ public class WxMenuTest {
|
||||
menu.getButtons().add(button1);
|
||||
|
||||
WxMenu.WxMenuRule wxMenuRule = new WxMenu.WxMenuRule();
|
||||
wxMenuRule.setGroupId("2");
|
||||
wxMenuRule.setTagId("2");
|
||||
wxMenuRule.setSex("1");
|
||||
wxMenuRule.setCountry("中国");
|
||||
wxMenuRule.setProvince("广东");
|
||||
|
Reference in New Issue
Block a user