From a32d020b7c3ccfbad349ca4203a029fd62f5162f Mon Sep 17 00:00:00 2001 From: x ronger Date: Mon, 14 Sep 2020 20:12:42 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E5=BE=AE=E4=BF=A1=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=B0=81=E8=A3=85=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rymcu/vertical/wx/mp/handler/MsgHandler.java | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/rymcu/vertical/wx/mp/handler/MsgHandler.java b/src/main/java/com/rymcu/vertical/wx/mp/handler/MsgHandler.java index 74cde99..c4a2cf0 100644 --- a/src/main/java/com/rymcu/vertical/wx/mp/handler/MsgHandler.java +++ b/src/main/java/com/rymcu/vertical/wx/mp/handler/MsgHandler.java @@ -1,8 +1,6 @@ package com.rymcu.vertical.wx.mp.handler; import com.rymcu.vertical.wx.mp.builder.TextBuilder; -import com.rymcu.vertical.wx.mp.utils.JsonUtils; -import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.session.WxSessionManager; import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; @@ -29,21 +27,13 @@ public class MsgHandler extends AbstractHandler { //TODO 可以选择将消息保存到本地 } - //当用户输入关键词如“你好”,“客服”等,并且有客服在线时,把消息转发给在线客服 - try { - if (StringUtils.startsWithAny(wxMessage.getContent(), "你好", "客服") - && weixinService.getKefuService().kfOnlineList() - .getKfOnlineList().size() > 0) { - return WxMpXmlOutMessage.TRANSFER_CUSTOMER_SERVICE() + if (wxMessage == null || StringUtils.isBlank(wxMessage.getContent())) { + return WxMpXmlOutMessage.TRANSFER_CUSTOMER_SERVICE() .fromUser(wxMessage.getToUser()) .toUser(wxMessage.getFromUser()).build(); - } - } catch (WxErrorException e) { - e.printStackTrace(); } - //TODO 组装回复消息 - String content = "收到信息内容:" + JsonUtils.toJson(wxMessage); + String content = "我们已经收到您的留言,稍后客服将会联系您!"; return new TextBuilder().build(content, wxMessage, weixinService);