update md
This commit is contained in:
parent
292fc5e01e
commit
55246ab9b4
@ -136,4 +136,8 @@
|
||||
|
||||
+ 新增了群发消息中的上传视频接口
|
||||
|
||||
+ 调整群发消息接口返回类型为字符串数组[{msg_id,msg_data_id}]
|
||||
+ 调整群发消息接口返回类型为字符串数组[{msg_id,msg_data_id}]
|
||||
|
||||
* 2015-08-09
|
||||
|
||||
+ version upgrade to 1.5.2
|
||||
@ -92,4 +92,6 @@
|
||||
|
||||
+ 会话API暴露到WeixinProxy类
|
||||
|
||||
+ 重命名NotifyApi#sendNotify为sendNotifyMessage
|
||||
+ 重命名NotifyApi#sendNotify为sendNotifyMessage
|
||||
|
||||
+ version upgrade to 1.5.2
|
||||
@ -76,4 +76,10 @@
|
||||
|
||||
* 2015-08-06
|
||||
|
||||
+ 调整`LocationEventMessage`类中的经纬度字段类型为double
|
||||
+ 调整`LocationEventMessage`类中的经纬度字段类型为double
|
||||
|
||||
* 2015-08-09
|
||||
|
||||
+ version upgrade to 1.0.4
|
||||
|
||||
+ 调整WeixinServerBootstrap明文构造函数的参数为token
|
||||
@ -39,7 +39,6 @@ public class WeixinResponseEncoder extends
|
||||
List<Object> out) throws WeixinException {
|
||||
WeixinMessageTransfer messageTransfer = ctx.channel()
|
||||
.attr(Consts.MESSAGE_TRANSFER_KEY).get();
|
||||
AesToken aesToken = messageTransfer.getAesToken();
|
||||
EncryptType encryptType = messageTransfer.getEncryptType();
|
||||
StringBuilder content = new StringBuilder();
|
||||
content.append("<xml>");
|
||||
@ -55,6 +54,7 @@ public class WeixinResponseEncoder extends
|
||||
content.append(response.toContent());
|
||||
content.append("</xml>");
|
||||
if (encryptType == EncryptType.AES) {
|
||||
AesToken aesToken = messageTransfer.getAesToken();
|
||||
String nonce = RandomUtil.generateString(32);
|
||||
String timestamp = Long
|
||||
.toString(System.currentTimeMillis() / 1000l);
|
||||
|
||||
@ -81,25 +81,23 @@ public final class WeixinServerBootstrap {
|
||||
*
|
||||
* 明文模式
|
||||
*
|
||||
* @param weixinid
|
||||
* 微信号(原始ID/appid/corpid)
|
||||
* @param token
|
||||
* 开发者token
|
||||
*
|
||||
*/
|
||||
public WeixinServerBootstrap(String weixinid, String token) {
|
||||
this(weixinid, token, null);
|
||||
public WeixinServerBootstrap(String token) {
|
||||
this(null, token, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 兼容模式 & 密文模式
|
||||
* 明文模式 & 兼容模式 & 密文模式
|
||||
*
|
||||
* @param appid
|
||||
* 公众号的应用ID(appid/corpid)
|
||||
* 公众号的应用ID(appid/corpid) 密文&兼容模式下需要填写
|
||||
* @param token
|
||||
* 开发者填写的token
|
||||
* 开发者填写的token 无论哪种模式都需要填写
|
||||
* @param aesKey
|
||||
* 消息加密的密钥
|
||||
* 消息加密的密钥 密文&兼容模式下需要填写
|
||||
*/
|
||||
public WeixinServerBootstrap(String appid, String token, String aesKey) {
|
||||
this(new AesToken(appid, token, aesKey));
|
||||
@ -142,12 +140,13 @@ public final class WeixinServerBootstrap {
|
||||
throw new IllegalArgumentException("AesToken not be null");
|
||||
}
|
||||
this.aesTokenMap = new HashMap<String, AesToken>();
|
||||
for (AesToken aesToken : aesTokens) {
|
||||
this.aesTokenMap.put(aesToken.getWeixinId(), aesToken);
|
||||
}
|
||||
// default..
|
||||
if (aesTokens.length == 1) {
|
||||
this.aesTokenMap.put(aesTokens[0].getWeixinId(), aesTokens[0]);
|
||||
this.aesTokenMap.put(null, aesTokens[0]);
|
||||
} else {
|
||||
for (AesToken aesToken : aesTokens) {
|
||||
this.aesTokenMap.put(aesToken.getWeixinId(), aesToken);
|
||||
}
|
||||
}
|
||||
this.messageHandlerList = new LinkedList<WeixinMessageHandler>();
|
||||
this.messageInterceptorList = new LinkedList<WeixinMessageInterceptor>();
|
||||
|
||||
@ -24,9 +24,7 @@ import com.foxinmy.weixin4j.startup.WeixinServerBootstrap;
|
||||
*/
|
||||
public class MessageServerStartup {
|
||||
|
||||
// 微信号(原始ID)
|
||||
final String openid = "gh_22b350df957b";
|
||||
// 应用ID
|
||||
// 公众号ID
|
||||
final String appid = "wx4ab8f8de58159a57";
|
||||
// 开发者token
|
||||
final String token = "weixin4j";
|
||||
@ -40,8 +38,8 @@ public class MessageServerStartup {
|
||||
*/
|
||||
public void test1() throws WeixinException {
|
||||
// 所有请求都回复调试的文本消息
|
||||
new WeixinServerBootstrap(openid, token).addHandler(
|
||||
DebugMessageHandler.global).startup();
|
||||
new WeixinServerBootstrap(token).addHandler(DebugMessageHandler.global)
|
||||
.startup();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,8 +75,8 @@ public class MessageServerStartup {
|
||||
public void test4() throws WeixinException {
|
||||
// 扫描包加载消息处理器
|
||||
String packageToScan = "com.foxinmy.weixin4j.handler";
|
||||
new WeixinServerBootstrap(openid, token).handlerPackagesToScan(
|
||||
packageToScan).startup();
|
||||
new WeixinServerBootstrap(token).handlerPackagesToScan(packageToScan)
|
||||
.startup();
|
||||
}
|
||||
|
||||
public void test5() throws WeixinException {
|
||||
@ -108,7 +106,7 @@ public class MessageServerStartup {
|
||||
System.err.println("请求处理完毕");
|
||||
}
|
||||
};
|
||||
new WeixinServerBootstrap(openid, token).addInterceptor(interceptor)
|
||||
new WeixinServerBootstrap(token).addInterceptor(interceptor)
|
||||
.openAlwaysResponse().startup();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user