diff --git a/business/jxstore/event/event_tcp_utils.go b/business/jxstore/event/event_tcp_utils.go
index d3112ba52..05e4b3b73 100644
--- a/business/jxstore/event/event_tcp_utils.go
+++ b/business/jxstore/event/event_tcp_utils.go
@@ -478,28 +478,33 @@ func replaceContent(content string, printMsg *model.PrintMsg) (result string) {
result = strings.ReplaceAll(result, byteSignQrRight, hexSignQrRight+hexSignQr+hexLenqr+"00")
result = strings.ReplaceAll(result, byteSignQrRightE, hexSignQrEnd)
}
- // 固定模板输出语音
+ // 固定模板输出语音 3c736f756e643e 3634 3c2f736f756e643e
if strings.Contains(result, byteSignSound) && strings.Contains(result, byteSignSoundE) {
- if sounds := regexpSound.FindStringSubmatch(result); len(sounds) > 0 {
- sound := sounds[1]
- //先把结束标签消了
- result = strings.ReplaceAll(result, byteSignSoundE, "") // 3c736f756e643e 3230 3c736f756e643e
- // 将语音包转换为十六进制
- voice := ""
- for _, v := range strings.Split(sound, "2c") {
- voice += hexSignSoundSolidification
- soundNum, _ := hex.DecodeString(v) // 十六进制转字符串
- intSound, _ := strconv.ParseInt(string(soundNum), 10, 64)
- int16Sound := strconv.FormatInt(intSound, 16)
- if intSound < PrintSoundMaxNumber { // 小于十六补位
- voice += PlaceFillingParam + int16Sound
- } else {
- voice += int16Sound
+ soundStr := ""
+ for _, v1 := range strings.Split(result, byteSignSoundE) {
+ v1 += byteSignSoundE
+ if sounds := regexpSound.FindStringSubmatch(v1); len(sounds) > 0 {
+ sound := sounds[1]
+ //先把结束标签消了
+ resultV1 := strings.ReplaceAll(v1, byteSignSoundE, "")
+ // 将语音包转换为十六进制
+ voice := ""
+ for _, v := range strings.Split(sound, "2c") {
+ voice += hexSignSoundSolidification
+ soundNum, _ := hex.DecodeString(v) // 十六进制转字符串
+ intSound, _ := strconv.ParseInt(string(soundNum), 10, 64)
+ int16Sound := strconv.FormatInt(intSound, 16)
+ if intSound < PrintSoundMaxNumber { // 小于十六补位
+ voice += PlaceFillingParam + int16Sound
+ } else {
+ voice += int16Sound
+ }
}
+ soundParam := strings.ReplaceAll(resultV1, sound, "")
+ soundStr += strings.ReplaceAll(soundParam, byteSignSound, voice)
}
- result = strings.ReplaceAll(result, sound, "")
- result = strings.ReplaceAll(result, byteSignSound, voice)
}
+ result = soundStr
}
// 自动合成语音功能
//if strings.Contains(result, byteSignSound) && strings.Contains(result, byteSignSoundE) {
diff --git a/business/jxstore/event/print_test.go b/business/jxstore/event/print_test.go
index 5acfa3037..a7d1c71f9 100644
--- a/business/jxstore/event/print_test.go
+++ b/business/jxstore/event/print_test.go
@@ -16,7 +16,7 @@ func TestPrintMsg(t *testing.T) {
msg := &model.PrintMsg{
ModelIDCULD: model.ModelIDCULD{},
PrintNo: "20220707000002",
- Content: "64,65,66",
+ Content: "77",
OrderNo: 202207261655,
Status: 0,
Comment: "",