aestoken
This commit is contained in:
parent
43b07a936b
commit
30ec46895d
@ -36,7 +36,7 @@ base on netty.
|
||||
|
||||
public class MessageServerStartup{
|
||||
public static void main(String[] args) {
|
||||
new WeixinServerBootstrap("token","appid","aesKey").addHandler(
|
||||
new WeixinServerBootstrap("appid/corpid","token","aesKey").addHandler(
|
||||
DebugMessageHandler.global).startup();
|
||||
}
|
||||
}
|
||||
@ -54,7 +54,7 @@ base on netty.
|
||||
}
|
||||
};
|
||||
// 当消息类型为文本(text)时回复「HelloWorld」, 否则回复调试消息
|
||||
new WeixinServerBootstrap(token, appid, aesKey).addHandler(
|
||||
new WeixinServerBootstrap(appid, token, aesKey).addHandler(
|
||||
messageHandler, DebugMessageHandler.global).startup();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user