This commit is contained in:
邹宗楠
2022-08-04 15:17:29 +08:00
parent d294481d5a
commit 48b46da333
2 changed files with 7 additions and 4 deletions

View File

@@ -222,11 +222,12 @@ func (t *TcpClient) doPrint(key string) (err error) {
case printerStatusOnline:
if c = t.getPrintConn(printMsg.PrintNo); c != nil {
data, err = buildMsg(printMsg)
printMsg.ContentEncryption = string(data)
globals.SugarLogger.Debug("================print_msg:", string(data))
if _, err := dao.UpdateEntity(db, printMsg, "ContentEncryption"); err != nil {
globals.SugarLogger.Debug("================print_msg:", err)
encryption := ""
for _, v := range data {
encryption += fmt.Sprintf("%d", v)
}
printMsg.ContentEncryption = encryption
dao.UpdateEntity(db, printMsg, "ContentEncryption")
}
case printerStatusOffline:
err = fmt.Errorf("打印机离线!")

View File

@@ -24,6 +24,8 @@ func TestPrintMsg(t *testing.T) {
}
data, err := buildMsg(msg)
fmt.Println("data=", fmt.Sprintf("%s", string(data...)))
fmt.Println("data=", string(data))
fmt.Println("err=", err)
}