修改WeixinMessageHandler.doHandle的返回值为SingleResponse
This commit is contained in:
parent
bcb0c51766
commit
432575988b
@ -297,6 +297,42 @@
|
|||||||
<code>40074</code>
|
<code>40074</code>
|
||||||
<text>news消息不支持指定为高保密消息</text>
|
<text>news消息不支持指定为高保密消息</text>
|
||||||
</error>
|
</error>
|
||||||
|
<error>
|
||||||
|
<code>40077</code>
|
||||||
|
<text>不合法的预授权码</text>
|
||||||
|
</error>
|
||||||
|
<error>
|
||||||
|
<code>40078</code>
|
||||||
|
<text>不合法的临时授权码</text>
|
||||||
|
</error>
|
||||||
|
<error>
|
||||||
|
<code>40079</code>
|
||||||
|
<text>不合法的授权信息</text>
|
||||||
|
</error>
|
||||||
|
<error>
|
||||||
|
<code>40080</code>
|
||||||
|
<text>不合法的suitesecret</text>
|
||||||
|
</error>
|
||||||
|
<error>
|
||||||
|
<code>40082</code>
|
||||||
|
<text>不合法的suitetoken</text>
|
||||||
|
</error>
|
||||||
|
<error>
|
||||||
|
<code>40083</code>
|
||||||
|
<text>不合法的suiteid</text>
|
||||||
|
</error>
|
||||||
|
<error>
|
||||||
|
<code>40084</code>
|
||||||
|
<text>不合法的永久授权码</text>
|
||||||
|
</error>
|
||||||
|
<error>
|
||||||
|
<code>40085</code>
|
||||||
|
<text>不合法的suiteticket</text>
|
||||||
|
</error>
|
||||||
|
<error>
|
||||||
|
<code>40086</code>
|
||||||
|
<text>不合法的第三方应用appid</text>
|
||||||
|
</error>
|
||||||
<error>
|
<error>
|
||||||
<code>40117</code>
|
<code>40117</code>
|
||||||
<text>分组名字不合法</text>
|
<text>分组名字不合法</text>
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import com.foxinmy.weixin4j.interceptor.WeixinMessageInterceptor;
|
|||||||
import com.foxinmy.weixin4j.request.WeixinMessage;
|
import com.foxinmy.weixin4j.request.WeixinMessage;
|
||||||
import com.foxinmy.weixin4j.request.WeixinRequest;
|
import com.foxinmy.weixin4j.request.WeixinRequest;
|
||||||
import com.foxinmy.weixin4j.response.BlankResponse;
|
import com.foxinmy.weixin4j.response.BlankResponse;
|
||||||
|
import com.foxinmy.weixin4j.response.SingleResponse;
|
||||||
import com.foxinmy.weixin4j.response.WeixinResponse;
|
import com.foxinmy.weixin4j.response.WeixinResponse;
|
||||||
import com.foxinmy.weixin4j.type.AccountType;
|
import com.foxinmy.weixin4j.type.AccountType;
|
||||||
import com.foxinmy.weixin4j.util.ClassUtil;
|
import com.foxinmy.weixin4j.util.ClassUtil;
|
||||||
@ -137,9 +138,12 @@ public class WeixinMessageDispatcher {
|
|||||||
}
|
}
|
||||||
WeixinException dispatchException = null;
|
WeixinException dispatchException = null;
|
||||||
try {
|
try {
|
||||||
WeixinResponse response = handlerExecutor.getMessageHandler()
|
SingleResponse response = handlerExecutor.getMessageHandler()
|
||||||
.doHandle(request, message, cruxMessage.getNodeNames());
|
.doHandle(request, message, cruxMessage.getNodeNames());
|
||||||
handlerExecutor.applyPostHandle(request, response, message);
|
if (response instanceof WeixinResponse) {
|
||||||
|
handlerExecutor.applyPostHandle(request,
|
||||||
|
(WeixinResponse) response, message);
|
||||||
|
}
|
||||||
context.write(response);
|
context.write(response);
|
||||||
} catch (WeixinException e) {
|
} catch (WeixinException e) {
|
||||||
dispatchException = e;
|
dispatchException = e;
|
||||||
|
|||||||
@ -33,9 +33,9 @@ public class DebugMessageHandler implements WeixinMessageHandler {
|
|||||||
@Override
|
@Override
|
||||||
public WeixinResponse doHandle(WeixinRequest request, Object message,
|
public WeixinResponse doHandle(WeixinRequest request, Object message,
|
||||||
Set<String> nodeNames) throws WeixinException {
|
Set<String> nodeNames) throws WeixinException {
|
||||||
String content = message == null ? content = request
|
String content = message == null ? request.getOriginalContent()
|
||||||
.getOriginalContent().replaceAll("\\!\\[CDATA\\[", "")
|
.replaceAll("\\!\\[CDATA\\[", "").replaceAll("\\]\\]", "")
|
||||||
.replaceAll("\\]\\]", "") : message.toString();
|
: message.toString();
|
||||||
return new TextResponse(content);
|
return new TextResponse(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||||
import com.foxinmy.weixin4j.request.WeixinRequest;
|
import com.foxinmy.weixin4j.request.WeixinRequest;
|
||||||
import com.foxinmy.weixin4j.response.WeixinResponse;
|
import com.foxinmy.weixin4j.response.SingleResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信消息处理器
|
* 微信消息处理器
|
||||||
@ -42,6 +42,6 @@ public interface WeixinMessageHandler {
|
|||||||
* 节点名称集合
|
* 节点名称集合
|
||||||
* @return 回复内容
|
* @return 回复内容
|
||||||
*/
|
*/
|
||||||
public WeixinResponse doHandle(WeixinRequest request, Object message,
|
public SingleResponse doHandle(WeixinRequest request, Object message,
|
||||||
Set<String> nodeNames) throws WeixinException;
|
Set<String> nodeNames) throws WeixinException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -325,5 +325,5 @@ public final class WeixinServerBootstrap {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static String VERSION = "1.0.3";
|
public final static String VERSION = "1.0.4";
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user