From 60ae59f801111b965b0deabaa3073bb31710f2e7 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Tue, 10 Aug 2021 10:45:38 +0800 Subject: [PATCH] aa --- business/jxstore/event/event_tcp.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index 65fdff122..75cdd4f29 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -245,15 +245,17 @@ func (t *TcpClient) doPrint(key string) (err error) { globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data)) //等待回调 dataStr := <-t.CallBackMap[printMsg.PrintNo] - a, b := getCallbackMsgInfo(dataStr) - t.changePrintMsg(dataStr, a, b) - //判断音频暂停? - //收到打印成功回调后,如果消息中有音频,需要等待一下,等上一个音频播完 - //暂停时间就暂时取的sound标签内内容长度/2 - if sounds := regexpSoundSpan.FindStringSubmatch(printMsg.Content); len(sounds) > 0 { - sound := sounds[1] - lenTime := time.Duration(utf8.RuneCountInString(sound)) * time.Second - time.Sleep(lenTime / 2) + if dataStr != "" { + a, b := getCallbackMsgInfo(dataStr) + t.changePrintMsg(dataStr, a, b) + //判断音频暂停? + //收到打印成功回调后,如果消息中有音频,需要等待一下,等上一个音频播完 + //暂停时间就暂时取的sound标签内内容长度/2 + if sounds := regexpSoundSpan.FindStringSubmatch(printMsg.Content); len(sounds) > 0 { + sound := sounds[1] + lenTime := time.Duration(utf8.RuneCountInString(sound)) * time.Second + time.Sleep(lenTime / 2) + } } } }