1
This commit is contained in:
@@ -385,6 +385,9 @@ func buildMsg(printMsg *model.PrintMsg) (data []byte, err error) {
|
|||||||
x1, x2 := int2h8l8(lenData / 2)
|
x1, x2 := int2h8l8(lenData / 2)
|
||||||
dataStr := str + x1 + x2 + const1 + orderNoHexH + orderNoHexL + printInit + printData
|
dataStr := str + x1 + x2 + const1 + orderNoHexH + orderNoHexL + printInit + printData
|
||||||
check := getCheckSum(dataStr)
|
check := getCheckSum(dataStr)
|
||||||
|
// 测试
|
||||||
|
printMsg.Comment = dataStr + check
|
||||||
|
dao.UpdateEntity(dao.GetDB(), printMsg, "Comment")
|
||||||
return jxutils.Hextob(dataStr + check), err
|
return jxutils.Hextob(dataStr + check), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
)
|
)
|
||||||
@@ -61,5 +62,23 @@ func TestCheckSum(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTen216(t *testing.T) {
|
func TestTen216(t *testing.T) {
|
||||||
|
aa := `
|
||||||
|
3c736f756e643e
|
||||||
|
312c322c33
|
||||||
|
3c2f736f756e643e
|
||||||
|
1b6101bed3d6d0cec4d7d60a1b6100
|
||||||
|
3c736f756e643e
|
||||||
|
342c352c36
|
||||||
|
3c2f736f756e643e
|
||||||
|
1b6101bed3d6d00a1b6100
|
||||||
|
`
|
||||||
|
bb := `1B59415501 1B59415502 1B59415503`
|
||||||
|
kk := `1B59415501 1B59415502 1B59415503 1b6101bed3d6d0cec4d7d60a1b6100 1b6101bed3d6d0cec4d7d60a1b6100 1B59415504 1B59415505 1B59415506 1b6101bed3d6d00a1b6100`
|
||||||
|
// 第一个语音字段
|
||||||
|
index1 := strings.Index(aa, "3c736f756e643e")
|
||||||
|
index2 := strings.Index(aa, "3c2f736f756e643e")
|
||||||
|
str := aa[index1:index2]
|
||||||
|
gg := strings.Replace(aa, str, bb, 1)
|
||||||
|
fmt.Println(gg)
|
||||||
|
fmt.Println(kk)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user