View Javadoc
1   package com.foxinmy.weixin4j.example.server.handler;
2   
3   import org.springframework.stereotype.Component;
4   
5   import com.foxinmy.weixin4j.handler.MessageHandlerAdapter;
6   import com.foxinmy.weixin4j.message.VoiceMessage;
7   import com.foxinmy.weixin4j.request.WeixinRequest;
8   import com.foxinmy.weixin4j.response.TextResponse;
9   import com.foxinmy.weixin4j.response.WeixinResponse;
10  
11  /**
12   * 只处理语音消息
13   *
14   * @className VoiceMessageHandler
15   * @author jinyu(foxinmy@gmail.com)
16   * @date 2015年11月18日
17   * @since JDK 1.6
18   */
19  @Component
20  public class VoiceMessageHandler extends MessageHandlerAdapter<VoiceMessage> {
21  
22      @Override
23      public WeixinResponse doHandle0(VoiceMessage message) {
24          /**
25           * 返回一段文字给用户
26           */
27          return new TextResponse("你讲了一句话");
28      }
29  }