This commit is contained in:
邹宗楠
2022-12-16 21:19:42 +08:00
parent 2deef73518
commit 45ba9ccc7a
2 changed files with 7 additions and 1 deletions

View File

@@ -251,7 +251,12 @@ func (t *TcpClient) doPrint(key string) (err error) {
close(t.TimeoutMap[key])
} else {
if c != nil {
printMsg.ContentEncryption = string(data)
encryption := ""
for _, v := range data {
encryption += fmt.Sprintf("%d", v)
}
printMsg.ContentEncryption = encryption
dao.UpdateEntity(db, printMsg, "ContentEncryption")
if _, err = c.Write(data); err != nil {
globals.SugarLogger.Debugf("handleTcpMessages err [%v]", err)

View File

@@ -386,6 +386,7 @@ func buildMsg(printMsg *model.PrintMsg) (data []byte, err error) {
lenData := int64(len(str) + len(const1) + len(orderNoHexH) + len(orderNoHexL) + len(printInit) + 2 + 4 + len(printData))
x1, x2 := int2h8l8(lenData / 2)
dataStr := str + x1 + x2 + const1 + orderNoHexH + orderNoHexL + printInit + printData
globals.SugarLogger.Debugf("============dataste %s", dataStr)
check := getCheckSum(dataStr)
return jxutils.Hextob(dataStr + check), err
}