aestoken
This commit is contained in:
parent
43b07a936b
commit
30ec46895d
@ -36,7 +36,7 @@ base on netty.
|
|||||||
|
|
||||||
public class MessageServerStartup{
|
public class MessageServerStartup{
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new WeixinServerBootstrap("token","appid","aesKey").addHandler(
|
new WeixinServerBootstrap("appid/corpid","token","aesKey").addHandler(
|
||||||
DebugMessageHandler.global).startup();
|
DebugMessageHandler.global).startup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ base on netty.
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
// 当消息类型为文本(text)时回复「HelloWorld」, 否则回复调试消息
|
// 当消息类型为文本(text)时回复「HelloWorld」, 否则回复调试消息
|
||||||
new WeixinServerBootstrap(token, appid, aesKey).addHandler(
|
new WeixinServerBootstrap(appid, token, aesKey).addHandler(
|
||||||
messageHandler, DebugMessageHandler.global).startup();
|
messageHandler, DebugMessageHandler.global).startup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,15 +97,16 @@ public final class WeixinServerBootstrap {
|
|||||||
/**
|
/**
|
||||||
* 明文模式 & 兼容模式 & 密文模式
|
* 明文模式 & 兼容模式 & 密文模式
|
||||||
*
|
*
|
||||||
|
* @param weixinId
|
||||||
|
* 公众号的应用ID(appid/corpid) 密文&兼容模式下需要填写
|
||||||
|
*
|
||||||
* @param token
|
* @param token
|
||||||
* 开发者填写的token 无论哪种模式都需要填写
|
* 开发者填写的token 无论哪种模式都需要填写
|
||||||
* @param appid
|
|
||||||
* 公众号的应用ID(appid/corpid) 密文&兼容模式下需要填写
|
|
||||||
* @param aesKey
|
* @param aesKey
|
||||||
* 消息加密的密钥 密文&兼容模式下需要填写
|
* 消息加密的密钥 密文&兼容模式下需要填写
|
||||||
*/
|
*/
|
||||||
public WeixinServerBootstrap(String token, String appid, String aesKey) {
|
public WeixinServerBootstrap(String weixinId, String token, String aesKey) {
|
||||||
this(new AesToken(appid, token, aesKey));
|
this(new AesToken(weixinId, token, aesKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -31,27 +31,27 @@ public class AesToken implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 一般为明文模式
|
* 一般为明文模式
|
||||||
*
|
*
|
||||||
* @param weixinid
|
* @param weixinId
|
||||||
* 微信号(原始ID/appid/corpid)
|
* 微信号(原始ID/appid/corpid)
|
||||||
* @param token
|
* @param token
|
||||||
* 开发者的Token
|
* 开发者的Token
|
||||||
*/
|
*/
|
||||||
public AesToken(String weixinid, String token) {
|
public AesToken(String weixinId, String token) {
|
||||||
this(weixinid, token, null);
|
this(weixinId, token, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 一般为AES加密模式
|
* 一般为AES加密模式
|
||||||
*
|
*
|
||||||
* @param appid
|
* @param weixinId
|
||||||
* 公众号的应用ID(appid/corpid)
|
* 公众号的应用ID(appid/corpid)
|
||||||
* @param token
|
* @param token
|
||||||
* 开发者Token
|
* 开发者Token
|
||||||
* @param aesKey
|
* @param aesKey
|
||||||
* 解密的EncodingAESKey
|
* 解密的EncodingAESKey
|
||||||
*/
|
*/
|
||||||
public AesToken(String appid, String token, String aesKey) {
|
public AesToken(String weixinId, String token, String aesKey) {
|
||||||
this.weixinId = appid;
|
this.weixinId = weixinId;
|
||||||
this.token = token;
|
this.token = token;
|
||||||
this.aesKey = aesKey;
|
this.aesKey = aesKey;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import com.foxinmy.weixin4j.startup.WeixinServerBootstrap;
|
|||||||
public class MessageServerStartup {
|
public class MessageServerStartup {
|
||||||
|
|
||||||
// 公众号ID
|
// 公众号ID
|
||||||
final String appid = "wx4ab8f8de58159a57";
|
final String weixinId = "wx4ab8f8de58159a57";
|
||||||
// 开发者token
|
// 开发者token
|
||||||
final String token = "weixin4j";
|
final String token = "weixin4j";
|
||||||
// AES密钥(安全模式)
|
// AES密钥(安全模式)
|
||||||
@ -49,7 +49,7 @@ public class MessageServerStartup {
|
|||||||
*/
|
*/
|
||||||
public void test2() throws WeixinException {
|
public void test2() throws WeixinException {
|
||||||
// 所有请求都回复调试的文本消息
|
// 所有请求都回复调试的文本消息
|
||||||
new WeixinServerBootstrap(appid, token, aesKey).addHandler(
|
new WeixinServerBootstrap(weixinId, token, aesKey).addHandler(
|
||||||
DebugMessageHandler.global).startup();
|
DebugMessageHandler.global).startup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ public class MessageServerStartup {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
// 当消息类型为文本(text)时回复「HelloWorld」, 否则回复调试消息
|
// 当消息类型为文本(text)时回复「HelloWorld」, 否则回复调试消息
|
||||||
new WeixinServerBootstrap(appid, token, aesKey).addHandler(
|
new WeixinServerBootstrap(weixinId, token, aesKey).addHandler(
|
||||||
messageHandler, DebugMessageHandler.global).startup();
|
messageHandler, DebugMessageHandler.global).startup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user