This commit is contained in:
jinyu
2015-09-16 22:28:10 +08:00
parent 43b07a936b
commit 30ec46895d
4 changed files with 16 additions and 15 deletions
@@ -97,15 +97,16 @@ public final class WeixinServerBootstrap {
/**
* 明文模式 & 兼容模式 & 密文模式
*
* @param weixinId
* 公众号的应用ID(appid/corpid) 密文&兼容模式下需要填写
*
* @param token
* 开发者填写的token 无论哪种模式都需要填写
* @param appid
* 公众号的应用ID(appid/corpid) 密文&兼容模式下需要填写
* @param aesKey
* 消息加密的密钥 密文&兼容模式下需要填写
*/
public WeixinServerBootstrap(String token, String appid, String aesKey) {
this(new AesToken(appid, token, aesKey));
public WeixinServerBootstrap(String weixinId, String token, String aesKey) {
this(new AesToken(weixinId, token, aesKey));
}
/**
@@ -31,27 +31,27 @@ public class AesToken implements Serializable {
/**
* 一般为明文模式
*
* @param weixinid
* @param weixinId
* 微信号(原始ID/appid/corpid)
* @param token
* 开发者的Token
*/
public AesToken(String weixinid, String token) {
this(weixinid, token, null);
public AesToken(String weixinId, String token) {
this(weixinId, token, null);
}
/**
* 一般为AES加密模式
*
* @param appid
* @param weixinId
* 公众号的应用ID(appid/corpid)
* @param token
* 开发者Token
* @param aesKey
* 解密的EncodingAESKey
*/
public AesToken(String appid, String token, String aesKey) {
this.weixinId = appid;
public AesToken(String weixinId, String token, String aesKey) {
this.weixinId = weixinId;
this.token = token;
this.aesKey = aesKey;
}
@@ -25,7 +25,7 @@ import com.foxinmy.weixin4j.startup.WeixinServerBootstrap;
public class MessageServerStartup {
// 公众号ID
final String appid = "wx4ab8f8de58159a57";
final String weixinId = "wx4ab8f8de58159a57";
// 开发者token
final String token = "weixin4j";
// AES密钥(安全模式)
@@ -49,7 +49,7 @@ public class MessageServerStartup {
*/
public void test2() throws WeixinException {
// 所有请求都回复调试的文本消息
new WeixinServerBootstrap(appid, token, aesKey).addHandler(
new WeixinServerBootstrap(weixinId, token, aesKey).addHandler(
DebugMessageHandler.global).startup();
}
@@ -68,7 +68,7 @@ public class MessageServerStartup {
}
};
// 当消息类型为文本(text)时回复「HelloWorld」, 否则回复调试消息
new WeixinServerBootstrap(appid, token, aesKey).addHandler(
new WeixinServerBootstrap(weixinId, token, aesKey).addHandler(
messageHandler, DebugMessageHandler.global).startup();
}