forked from chanjarster/weixin-java-tools
-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
企微第三方加好友回调,创建时间一样被判定为重复消息 #3311
Labels
Comments
可以加上,欢迎直接提交PR修复代码 |
楼主不方便贡献代码? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
简要描述
在企微第三方回调接口使用消息路由时发现,当加好友回调消息的创建时间一样,但外部联系人不同,企微用户也不同时会被判断为重复消息,导致没有进入到后续的handle,造成该客户的相关业务未能处理。
模块版本情况
详细描述
Class: me.chanjar.weixin.cp.tp.message.WxCpTpMessageRouter
Mehtod: isMsgDuplicated()
`private boolean isMsgDuplicated(WxCpTpXmlMessage wxMessage) {
StringBuilder messageId = new StringBuilder();
if (wxMessage.getInfoType() != null) {
messageId.append(wxMessage.getInfoType())
.append("-").append(StringUtils.trimToEmpty(wxMessage.getSuiteId()))
.append("-").append(wxMessage.getTimeStamp())
.append("-").append(StringUtils.trimToEmpty(wxMessage.getAuthCorpId()))
.append("-").append(StringUtils.trimToEmpty(wxMessage.getUserID()))
.append("-").append(StringUtils.trimToEmpty(wxMessage.getChangeType()))
.append("-").append(StringUtils.trimToEmpty(wxMessage.getServiceCorpId()))
.append("-").append(StringUtils.trimToEmpty(wxMessage.getExternalUserID()));
}
}`
在加好友回调中,InfoType为空,MsgID为空会进入到如图所示的逻辑中,此处createTime和FromUserName是相同的,而Event必定也是相同的,eventKey为空。所以会判定为重复消息,此处的messageId应加上ExternalUserID和userID作为唯一判定的key。
The text was updated successfully, but these errors were encountered: