From b0e8104334a35e9666f8beb1fab568c79389a003 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Fri, 9 Jul 2021 15:14:44 +0800 Subject: [PATCH] aa --- business/jxstore/event/event_tcp.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index d2c1d6662..ea7492ab2 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -475,14 +475,15 @@ func replaceContent(content string, printMsg *model.PrintMsg) (result string) { //001a (声音数据长度高八位低八位) //0101 固定 soundPerfix := "[" + utils.Int2Str(printer.Volume*2) + "]" + printer.Sound + "," - realSound := soundPerfix + sound + hexPrefix, _ := jxutils.Utf8ToGbk([]byte(soundPerfix)) + hexPrefixStr := hex.EncodeToString(hexPrefix) + realSound := hexPrefixStr + sound allLen := fmt.Sprintf("%x", (len("fd001a0101")+len(realSound))/2) if len(allLen) < 2 { allLen = "0" + allLen } - soundLenH, soundLenX := int2h8l8(int64(len(realSound) / 2)) - hexPrefix, _ := jxutils.Utf8ToGbk([]byte(soundPerfix)) - result = strings.ReplaceAll(result, byteSignSound, hexSignSound+allLen+"fd"+soundLenH+soundLenX+"0101"+hex.EncodeToString(hexPrefix)) + soundLenH, soundLenX := int2h8l8(int64(len(realSound) + len("0101")/2)) + result = strings.ReplaceAll(result, byteSignSound, hexSignSound+allLen+"fd"+soundLenH+soundLenX+"0101"+hexPrefixStr) } } }