Closed
Description
简要描述
接收小程序媒体检测回调消息时,进入方法cn.binarywang.wx.miniapp.message.WxMaMessageRouter#isMsgDuplicated判断消息是否重复
private boolean isMsgDuplicated(WxMaMessage wxMessage) {
StringBuilder messageId = new StringBuilder();
if (wxMessage.getMsgId() == null) {
messageId.append(wxMessage.getCreateTime())
.append("-").append(wxMessage.getFromUser())
.append("-").append(StringUtils.trimToEmpty(wxMessage.getEvent()));
} else {
messageId.append(wxMessage.getMsgId())
.append("-").append(wxMessage.getCreateTime())
.append("-").append(wxMessage.getFromUser());
}
if (StringUtils.isNotEmpty(wxMessage.getToUser())) {
messageId.append("-").append(wxMessage.getToUser());
}
return this.messageDuplicateChecker.isDuplicate(messageId.toString());
}
以下是同一个小程序、同一时间发起的2条媒体检测,解密后的回调数据:
{"ToUserName":"xx","FromUserName":"xx","CreateTime":1655747827,"MsgType":"event","Event":"wxa_media_check","isrisky":"0","extra_info_json":"","appid":"xx","trace_id":"db6a6eb16fd1c8afe425b1c76917cc0c","status_code":"0"}
{"ToUserName":"xx","FromUserName":"xx","CreateTime":1655747827,"MsgType":"event","Event":"wxa_media_check","isrisky":"0","extra_info_json":"","appid":"xx","trace_id":"fbef75edb40bd0b95ea0d138ca6d71f8","status_code":"0"}
只有trace_id不同,可见这种情况下根据CreateTime及ToUserName不足以作为唯一条件,导致消息丢失
模块版本情况
- WxJava 模块名: 4.3.0
Metadata
Assignees
Labels
No labels