diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index 58c26a39e..bc698bfee 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -470,8 +470,13 @@ func replaceContent(content string, printMsg *model.PrintMsg) (result string) { //fd 固定 //001a (声音数据长度高八位低八位) //0101 固定 - soundPerfix := "[v" + utils.Int2Str(printer.Volume*2) + "]" + printer.Sound + "," - hexPrefix, _ := jxutils.Utf8ToGbk([]byte(soundPerfix)) + soundPrefix := "" + if printer.Sound != "" { + soundPrefix = "[v" + utils.Int2Str(printer.Volume*2) + "]" + printer.Sound + "," + } else { + soundPrefix = "[v" + utils.Int2Str(printer.Volume*2) + "]" + } + hexPrefix, _ := jxutils.Utf8ToGbk([]byte(soundPrefix)) hexPrefixStr := hex.EncodeToString(hexPrefix) realSound := hexPrefixStr + sound allLen := fmt.Sprintf("%x", (len("fd001a0101")+len(realSound))/2)