From f077bf428322a740ccc272bd3b3ea8994ed1b9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 27 Jul 2022 17:48:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=AD=E9=9F=B3=E8=B0=83?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/event/event_tcp.go | 1 - business/jxstore/event/event_tcp_utils.go | 48 +++++++++++------------ main.go | 2 - 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index dbda527d5..32255c58a 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -246,7 +246,6 @@ func (t *TcpClient) doPrint(key string) (err error) { close(t.TimeoutMap[key]) } else { globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data)) - globals.SugarLogger.Debugf("data================: %v", "1e00140200ff50bc147df3d71b401B59415515ff") //等待回调 dataStr := <-t.CallBackMap[printMsg.PrintNo] if dataStr != "" { diff --git a/business/jxstore/event/event_tcp_utils.go b/business/jxstore/event/event_tcp_utils.go index 198e8b296..e327efd98 100644 --- a/business/jxstore/event/event_tcp_utils.go +++ b/business/jxstore/event/event_tcp_utils.go @@ -494,30 +494,30 @@ 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] - if printer, _ := dao.GetPrinter(dao.GetDB(), printMsg.PrintNo); printer != nil { - //先把结束标签消了 - result = strings.ReplaceAll(result, byteSignSoundE, "") - 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) - 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) - } - } - } + //if strings.Contains(result, byteSignSound) && strings.Contains(result, byteSignSoundE) { + // if sounds := regexpSound.FindStringSubmatch(result); len(sounds) > 0 { + // sound := sounds[1] + // if printer, _ := dao.GetPrinter(dao.GetDB(), printMsg.PrintNo); printer != nil { + // //先把结束标签消了 + // result = strings.ReplaceAll(result, byteSignSoundE, "") + // 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) + // 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) + // } + // } + //} return result } diff --git a/main.go b/main.go index cd9382ea2..4faaee6fe 100644 --- a/main.go +++ b/main.go @@ -128,10 +128,8 @@ func main() { http.ListenAndServe("0.0.0.0:6060", nil) } }() - globals.SugarLogger.Debug("=========1========1============", globals.IsPrintEnv()) if globals.IsPrintEnv() { - globals.SugarLogger.Debug("=========2========2============", globals.IsPrintEnv()) event.ListenTcp() } beego.Run()