1
This commit is contained in:
@@ -524,30 +524,30 @@ func replaceContent(content string, printMsg *model.PrintMsg) (result string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 自动合成语音功能
|
// 自动合成语音功能
|
||||||
if strings.Contains(result, byteSignSound) && strings.Contains(result, byteSignSoundE) {
|
//if strings.Contains(result, byteSignSound) && strings.Contains(result, byteSignSoundE) {
|
||||||
if sounds := regexpSound.FindStringSubmatch(result); len(sounds) > 0 {
|
// if sounds := regexpSound.FindStringSubmatch(result); len(sounds) > 0 {
|
||||||
sound := sounds[1]
|
// sound := sounds[1]
|
||||||
if printer, _ := dao.GetPrinter(dao.GetDB(), printMsg.PrintNo); printer != nil {
|
// if printer, _ := dao.GetPrinter(dao.GetDB(), printMsg.PrintNo); printer != nil {
|
||||||
//先把结束标签消了
|
// //先把结束标签消了
|
||||||
result = strings.ReplaceAll(result, byteSignSoundE, "")
|
// result = strings.ReplaceAll(result, byteSignSoundE, "")
|
||||||
soundPrefix := ""
|
// soundPrefix := ""
|
||||||
if printer.Sound != "" {
|
// if printer.Sound != "" {
|
||||||
soundPrefix = "[v" + utils.Int2Str(printer.Volume*2) + "]" + printer.Sound
|
// soundPrefix = "[v" + utils.Int2Str(printer.Volume*2) + "]" + printer.Sound
|
||||||
} else {
|
// } else {
|
||||||
soundPrefix = "[v" + utils.Int2Str(printer.Volume*2) + "]"
|
// soundPrefix = "[v" + utils.Int2Str(printer.Volume*2) + "]"
|
||||||
}
|
// }
|
||||||
hexPrefix, _ := jxutils.Utf8ToGbk([]byte(soundPrefix))
|
// hexPrefix, _ := jxutils.Utf8ToGbk([]byte(soundPrefix))
|
||||||
hexPrefixStr := hex.EncodeToString(hexPrefix)
|
// hexPrefixStr := hex.EncodeToString(hexPrefix)
|
||||||
realSound := hexPrefixStr + sound
|
// realSound := hexPrefixStr + sound
|
||||||
allLen := fmt.Sprintf("%x", (len("fd001a0101")+len(realSound))/2)
|
// allLen := fmt.Sprintf("%x", (len("fd001a0101")+len(realSound))/2)
|
||||||
if len(allLen) < 2 {
|
// if len(allLen) < 2 {
|
||||||
allLen = "0" + allLen
|
// allLen = "0" + allLen
|
||||||
}
|
// }
|
||||||
soundLenH, soundLenX := int2h8l8(int64((len(realSound) + len("0101")) / 2))
|
// soundLenH, soundLenX := int2h8l8(int64((len(realSound) + len("0101")) / 2))
|
||||||
result = strings.ReplaceAll(result, byteSignSound, hexSignSound+allLen+"fd"+soundLenH+soundLenX+"0100"+hexPrefixStr)
|
// result = strings.ReplaceAll(result, byteSignSound, hexSignSound+allLen+"fd"+soundLenH+soundLenX+"0100"+hexPrefixStr)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user