From 9f7a64cbbea6afdfc5f84e5fa66b1d79e3260ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 26 Jul 2022 17:19:19 +0800 Subject: [PATCH] 1 --- business/jxstore/event/event_tcp_utils.go | 33 +---------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/business/jxstore/event/event_tcp_utils.go b/business/jxstore/event/event_tcp_utils.go index 0ff86003f..d5143e6ff 100644 --- a/business/jxstore/event/event_tcp_utils.go +++ b/business/jxstore/event/event_tcp_utils.go @@ -479,24 +479,8 @@ func replaceContent(content string, printMsg *model.PrintMsg) (result string) { if strings.Contains(result, byteSignSound) && strings.Contains(result, byteSignSoundE) { if sounds := regexpSound.FindStringSubmatch(result); len(sounds) > 0 { sound := sounds[1] - //printer := model.Printer{} - //printer.Volume = 4 - //printer.Sound = "sounda" - //if printer, _ := dao.GetPrinter(dao.GetDB(), printMsg.PrintNo); printer != nil { //先把结束标签消了 result = strings.ReplaceAll(result, byteSignSoundE, "") // 3c736f756e643e 3230 3c736f756e643e - //fd 固定 - //001a (声音数据长度高八位低八位) - //0101 固定 - //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) - // 将语音包转换为十六进制 voice := "" for _, v := range strings.Split(sound, "2c") { @@ -505,24 +489,9 @@ func replaceContent(content string, printMsg *model.PrintMsg) (result string) { int16Sound := strconv.FormatInt(intSound, 16) voice += int16Sound } - fmt.Println("voice=========", voice) - //voiceDataGBK, _ := jxutils.Utf8ToGbk([]byte(voice)) - //voiceData := hex.EncodeToString(voiceDataGBK) - - //[8]sounda14 ->5b385d736f756e64613134 - //hexPrefix, _ := jxutils.Utf8ToGbk([]byte(soundPrefix)) - //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) + len("0101")) / 2)) - //result = strings.ReplaceAll(result, byteSignSound, hexSignSound+allLen+"fd"+soundLenH+soundLenX+"0100"+hexPrefixStr) + globals.SugarLogger.Debug("voice==================", voice) result = strings.ReplaceAll(result, sound, "") result = strings.ReplaceAll(result, byteSignSound, hexSignSoundSolidification+"14") - //} } } // 自动合成语音功能