View Javadoc
1   package com.foxinmy.weixin4j.example.server.handler;
2   
3   import java.util.Set;
4   
5   import com.foxinmy.weixin4j.handler.WeixinMessageHandler;
6   import com.foxinmy.weixin4j.qy.chat.WeixinChatMessage;
7   import com.foxinmy.weixin4j.request.WeixinMessage;
8   import com.foxinmy.weixin4j.request.WeixinRequest;
9   import com.foxinmy.weixin4j.response.BlankResponse;
10  import com.foxinmy.weixin4j.response.WeixinResponse;
11  
12  public class ChatMessageHandler implements WeixinMessageHandler {
13  
14      @Override
15      public boolean canHandle(WeixinRequest request, WeixinMessage message, Set<String> nodeNames) {
16          return nodeNames.contains("PackageId");
17      }
18  
19      @Override
20      public WeixinResponse doHandle(WeixinRequest request, WeixinMessage message) {
21          WeixinChatMessage chatMessage = null; // 转换为实体
22          return BlankResponse.global;
23      }
24  
25      @Override
26      public int weight() {
27          return 0;
28      }
29  }