From 6ea9fe10f279321f325a7e96f39e57ee2aac6f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=96=87=E6=B8=85?= Date: Mon, 8 May 2017 10:45:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E5=8F=91=E5=88=B0=E5=AE=A2=E6=9C=8D?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=8F=AF=E4=B8=8D=E6=8C=87=E5=AE=9A=E5=AE=A2?= =?UTF-8?q?=E6=9C=8D=E8=B4=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sd4324530/fastweixin/message/CustomMsg.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/sd4324530/fastweixin/message/CustomMsg.java b/src/main/java/com/github/sd4324530/fastweixin/message/CustomMsg.java index fa52575..094f7d7 100644 --- a/src/main/java/com/github/sd4324530/fastweixin/message/CustomMsg.java +++ b/src/main/java/com/github/sd4324530/fastweixin/message/CustomMsg.java @@ -1,11 +1,16 @@ package com.github.sd4324530.fastweixin.message; import com.github.sd4324530.fastweixin.message.util.MessageBuilder; +import com.github.sd4324530.fastweixin.util.StrUtil; public class CustomMsg extends BaseMsg { private String kfAccount; + public CustomMsg(){ + + } + public CustomMsg(String kfAccount) { this.kfAccount = kfAccount; } @@ -22,9 +27,12 @@ public class CustomMsg extends BaseMsg { public String toXml() { MessageBuilder mb = new MessageBuilder(super.toXml()); mb.addData("MsgType", RespType.KF); - mb.append("\n"); - mb.addData("KfAccount", kfAccount); - mb.append("\n"); + //可以不指定客服 + if(StrUtil.isNotBlank(kfAccount)) { + mb.append("\n"); + mb.addData("KfAccount", kfAccount); + mb.append("\n"); + } mb.surroundWith("xml"); return mb.toString(); } -- Gitee