aa
This commit is contained in:
@@ -52,6 +52,7 @@ const (
|
||||
signQrLeft = "<qrl>" //二维码居左
|
||||
signQrRight = "<qrr>" //二维码居右
|
||||
|
||||
hexSignBROrEXE = "0a"
|
||||
hexSignCenter = "1b6101"
|
||||
hexSignLeft = "1b6100"
|
||||
hexSignRight = "1b6102"
|
||||
@@ -95,7 +96,7 @@ var (
|
||||
}
|
||||
|
||||
signMap = map[string]string{
|
||||
byteSignBR: "0a",
|
||||
byteSignBR: hexSignBROrEXE,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -335,9 +336,9 @@ func buildMsg(printMsg *model.PrintMsg) (data []byte, err error) {
|
||||
printDataGBK, _ := jxutils.Utf8ToGbk([]byte(content))
|
||||
printData = hex.EncodeToString(printDataGBK)
|
||||
printData = replaceContent(printData)
|
||||
lenData := int64(len(str) + len(const1) + len(orderNoHexH) + len(orderNoHexL) + len(printInit)*2 + len(check) + 6 + len(printData))
|
||||
lenData := int64(len(str) + len(const1) + len(orderNoHexH) + len(orderNoHexL) + len(printInit)*2 + len(check) + len(hexSignBROrEXE) + 4 + len(printData))
|
||||
x1, x2 := int2h8l8(lenData / 2)
|
||||
dataStr := str + x1 + x2 + const1 + orderNoHexH + orderNoHexL + printInit + printData + "0a" + printInit + check
|
||||
dataStr := str + x1 + x2 + const1 + orderNoHexH + orderNoHexL + printInit + printData + hexSignBROrEXE + printInit + check
|
||||
return jxutils.Hextob(dataStr), err
|
||||
}
|
||||
|
||||
@@ -349,10 +350,10 @@ func replaceContent(content string) (result string) {
|
||||
result = strings.ReplaceAll(result, k, v)
|
||||
}
|
||||
}
|
||||
//if strings.Contains(result, byteSignCenter) && strings.Contains(result, byteSignCenterE) {
|
||||
result = strings.ReplaceAll(result, byteSignCenter, hexSignCenter)
|
||||
result = strings.ReplaceAll(result, byteSignCenterE, hexSignLeft)
|
||||
//}
|
||||
if strings.Contains(result, byteSignCenter) && strings.Contains(result, byteSignCenterE) {
|
||||
result = strings.ReplaceAll(result, byteSignCenter, hexSignCenter)
|
||||
result = strings.ReplaceAll(result, byteSignCenterE, hexSignLeft)
|
||||
}
|
||||
if strings.Contains(result, byteSignLeft) && strings.Contains(result, byteSignLeftE) {
|
||||
result = strings.ReplaceAll(result, byteSignLeft, hexSignLeft)
|
||||
result = strings.ReplaceAll(result, byteSignLeftE, hexSignLeft)
|
||||
@@ -361,10 +362,10 @@ func replaceContent(content string) (result string) {
|
||||
result = strings.ReplaceAll(result, byteSignRight, hexSignRight)
|
||||
result = strings.ReplaceAll(result, byteSignRightE, hexSignLeft)
|
||||
}
|
||||
//if strings.Contains(result, byteSignBig) && strings.Contains(result, byteSignBigE) {
|
||||
result = strings.ReplaceAll(result, byteSignBig, hexSignBig)
|
||||
result = strings.ReplaceAll(result, byteSignBigE, hexSignNormal)
|
||||
//}
|
||||
if strings.Contains(result, byteSignBig) && strings.Contains(result, byteSignBigE) {
|
||||
result = strings.ReplaceAll(result, byteSignBig, hexSignBig)
|
||||
result = strings.ReplaceAll(result, byteSignBigE, hexSignNormal)
|
||||
}
|
||||
if strings.Contains(result, byteSignHighBig) && strings.Contains(result, byteSignHighBigE) {
|
||||
result = strings.ReplaceAll(result, byteSignHighBig, hexSignHighBig)
|
||||
result = strings.ReplaceAll(result, byteSignHighBigE, hexSignNormal)
|
||||
|
||||
Reference in New Issue
Block a user