mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-09-20 02:29:44 +08:00
issue #46
This commit is contained in:
@@ -119,6 +119,8 @@ public class WxCpMessageRouter {
|
||||
|
||||
private boolean async = true;
|
||||
|
||||
private String fromUser;
|
||||
|
||||
private String msgType;
|
||||
|
||||
private String event;
|
||||
@@ -212,6 +214,16 @@ public class WxCpMessageRouter {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果fromUser等于某值
|
||||
* @param fromUser
|
||||
* @return
|
||||
*/
|
||||
public Rule fromUser(String fromUser) {
|
||||
this.fromUser = fromUser;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置微信消息拦截器
|
||||
* @param interceptor
|
||||
@@ -282,6 +294,8 @@ public class WxCpMessageRouter {
|
||||
|
||||
protected boolean test(WxCpXmlMessage wxMessage) {
|
||||
return
|
||||
(this.fromUser == null || this.fromUser.equals(wxMessage.getFromUserName()))
|
||||
&&
|
||||
(this.agentId == null || this.agentId.equals(wxMessage.getAgentId()))
|
||||
&&
|
||||
(this.msgType == null || this.msgType.equals(wxMessage.getMsgType()))
|
||||
|
Reference in New Issue
Block a user