Merge pull request #76 from wechat-group/revert-75-agentid-type

Revert "修改WxCpMessage中agentId的数据类型, String-> Integer"
This commit is contained in:
Binary Wang 2016-11-16 15:21:28 +08:00 committed by GitHub
commit e7d70307eb
8 changed files with 298 additions and 294 deletions

1
.gitignore vendored
View File

@ -26,7 +26,6 @@ test-config.xml
/gradle/ /gradle/
*.bat *.bat
/gradlew /gradlew
**/build/
# OSX # OSX
# Icon must end with two \r # Icon must end with two \r

View File

@ -45,7 +45,7 @@ public interface WxCpConfigStorage {
String getCorpSecret(); String getCorpSecret();
Integer getAgentId(); String getAgentId();
String getToken(); String getToken();

View File

@ -19,7 +19,7 @@ public class WxCpInMemoryConfigStorage implements WxCpConfigStorage {
protected volatile String token; protected volatile String token;
protected volatile String accessToken; protected volatile String accessToken;
protected volatile String aesKey; protected volatile String aesKey;
protected volatile Integer agentId; protected volatile String agentId;
protected volatile long expiresTime; protected volatile long expiresTime;
protected volatile String oauth2redirectUri; protected volatile String oauth2redirectUri;
@ -146,11 +146,11 @@ public class WxCpInMemoryConfigStorage implements WxCpConfigStorage {
} }
@Override @Override
public Integer getAgentId() { public String getAgentId() {
return this.agentId; return this.agentId;
} }
public void setAgentId(Integer agentId) { public void setAgentId(String agentId) {
this.agentId = agentId; this.agentId = agentId;
} }

View File

@ -25,7 +25,7 @@ public class WxCpJedisConfigStorage implements WxCpConfigStorage {
private volatile String token; private volatile String token;
private volatile String aesKey; private volatile String aesKey;
private volatile Integer agentId; private volatile String agentId;
private volatile String oauth2redirectUri; private volatile String oauth2redirectUri;
@ -150,7 +150,7 @@ public class WxCpJedisConfigStorage implements WxCpConfigStorage {
} }
@Override @Override
public Integer getAgentId() { public String getAgentId() {
return this.agentId; return this.agentId;
} }
@ -230,7 +230,7 @@ public class WxCpJedisConfigStorage implements WxCpConfigStorage {
this.aesKey = aesKey; this.aesKey = aesKey;
} }
public void setAgentId(Integer agentId) { public void setAgentId(String agentId) {
this.agentId = agentId; this.agentId = agentId;
} }

View File

@ -160,7 +160,7 @@ public interface WxCpService {
* *
* @param menu * @param menu
* @throws WxErrorException * @throws WxErrorException
* @see #menuCreate(Integer, WxMenu) * @see #menuCreate(String, me.chanjar.weixin.common.bean.menu.WxMenu)
*/ */
void menuCreate(WxMenu menu) throws WxErrorException; void menuCreate(WxMenu menu) throws WxErrorException;
@ -177,7 +177,7 @@ public interface WxCpService {
* @throws WxErrorException * @throws WxErrorException
* @see #menuCreate(me.chanjar.weixin.common.bean.menu.WxMenu) * @see #menuCreate(me.chanjar.weixin.common.bean.menu.WxMenu)
*/ */
void menuCreate(Integer agentId, WxMenu menu) throws WxErrorException; void menuCreate(String agentId, WxMenu menu) throws WxErrorException;
/** /**
* <pre> * <pre>
@ -188,7 +188,7 @@ public interface WxCpService {
* </pre> * </pre>
* *
* @throws WxErrorException * @throws WxErrorException
* @see #menuDelete(Integer) * @see #menuDelete(String)
*/ */
void menuDelete() throws WxErrorException; void menuDelete() throws WxErrorException;
@ -204,7 +204,7 @@ public interface WxCpService {
* @throws WxErrorException * @throws WxErrorException
* @see #menuDelete() * @see #menuDelete()
*/ */
void menuDelete(Integer agentId) throws WxErrorException; void menuDelete(String agentId) throws WxErrorException;
/** /**
* <pre> * <pre>
@ -215,7 +215,7 @@ public interface WxCpService {
* </pre> * </pre>
* *
* @throws WxErrorException * @throws WxErrorException
* @see #menuGet(Integer) * @see #menuGet(String)
*/ */
WxMenu menuGet() throws WxErrorException; WxMenu menuGet() throws WxErrorException;
@ -231,7 +231,7 @@ public interface WxCpService {
* @throws WxErrorException * @throws WxErrorException
* @see #menuGet() * @see #menuGet()
*/ */
WxMenu menuGet(Integer agentId) throws WxErrorException; WxMenu menuGet(String agentId) throws WxErrorException;
/** /**
* <pre> * <pre>
@ -425,7 +425,7 @@ public interface WxCpService {
* *
* @param code * @param code
* @return [userid, deviceid] * @return [userid, deviceid]
* @see #oauth2getUserInfo(Integer, String) * @see #oauth2getUserInfo(String, String)
*/ */
String[] oauth2getUserInfo(String code) throws WxErrorException; String[] oauth2getUserInfo(String code) throws WxErrorException;
@ -443,7 +443,7 @@ public interface WxCpService {
* @return [userid, deviceid] * @return [userid, deviceid]
* @see #oauth2getUserInfo(String) * @see #oauth2getUserInfo(String)
*/ */
String[] oauth2getUserInfo(Integer agentId, String code) throws WxErrorException; String[] oauth2getUserInfo(String agentId, String code) throws WxErrorException;
/** /**

View File

@ -191,7 +191,7 @@ public class WxCpServiceImpl implements WxCpService {
} }
@Override @Override
public void menuCreate(Integer agentId, WxMenu menu) throws WxErrorException { public void menuCreate(String agentId, WxMenu menu) throws WxErrorException {
String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/create?agentid=" String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/create?agentid="
+ this.configStorage.getAgentId(); + this.configStorage.getAgentId();
post(url, menu.toJson()); post(url, menu.toJson());
@ -203,7 +203,7 @@ public class WxCpServiceImpl implements WxCpService {
} }
@Override @Override
public void menuDelete(Integer agentId) throws WxErrorException { public void menuDelete(String agentId) throws WxErrorException {
String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/delete?agentid=" + agentId; String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/delete?agentid=" + agentId;
get(url, null); get(url, null);
} }
@ -214,7 +214,7 @@ public class WxCpServiceImpl implements WxCpService {
} }
@Override @Override
public WxMenu menuGet(Integer agentId) throws WxErrorException { public WxMenu menuGet(String agentId) throws WxErrorException {
String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/get?agentid=" + agentId; String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/get?agentid=" + agentId;
try { try {
String resultContent = get(url, null); String resultContent = get(url, null);
@ -487,7 +487,7 @@ this.configStorage.getOauth2redirectUri(),
} }
@Override @Override
public String[] oauth2getUserInfo(Integer agentId, String code) throws WxErrorException { public String[] oauth2getUserInfo(String agentId, String code) throws WxErrorException {
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?" String url = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?"
+ "code=" + code + "code=" + code
+ "&agentid=" + agentId; + "&agentid=" + agentId;

View File

@ -1,12 +1,17 @@
package me.chanjar.weixin.cp.bean; package me.chanjar.weixin.cp.bean;
import me.chanjar.weixin.cp.bean.messagebuilder.*;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import me.chanjar.weixin.cp.bean.messagebuilder.FileBuilder;
import me.chanjar.weixin.cp.bean.messagebuilder.ImageBuilder;
import me.chanjar.weixin.cp.bean.messagebuilder.NewsBuilder;
import me.chanjar.weixin.cp.bean.messagebuilder.TextBuilder;
import me.chanjar.weixin.cp.bean.messagebuilder.VideoBuilder;
import me.chanjar.weixin.cp.bean.messagebuilder.VoiceBuilder;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
/** /**
* 消息 * 消息
* *
@ -18,7 +23,7 @@ public class WxCpMessage implements Serializable {
private String toUser; private String toUser;
private String toParty; private String toParty;
private String toTag; private String toTag;
private Integer agentId; private String agentId;
private String msgType; private String msgType;
private String content; private String content;
private String mediaId; private String mediaId;
@ -96,11 +101,11 @@ public class WxCpMessage implements Serializable {
this.toTag = toTag; this.toTag = toTag;
} }
public Integer getAgentId() { public String getAgentId() {
return this.agentId; return this.agentId;
} }
public void setAgentId(Integer agentId) { public void setAgentId(String agentId) {
this.agentId = agentId; this.agentId = agentId;
} }

View File

@ -5,13 +5,13 @@ import me.chanjar.weixin.cp.bean.WxCpMessage;
public class BaseBuilder<T> { public class BaseBuilder<T> {
protected String msgType; protected String msgType;
protected Integer agentId; protected String agentId;
protected String toUser; protected String toUser;
protected String toParty; protected String toParty;
protected String toTag; protected String toTag;
protected String safe; protected String safe;
public T agentId(Integer agentId) { public T agentId(String agentId) {
this.agentId = agentId; this.agentId = agentId;
return (T) this; return (T) this;
} }