This commit is contained in:
suyl
2021-07-21 18:45:03 +08:00
parent 4dd08d5255
commit 60b9a5f215

View File

@@ -226,8 +226,8 @@ func handleConn(c net.Conn) {
tcpClient.s.Unlock() tcpClient.s.Unlock()
} }
} else if strings.Contains(data, printText) { } else if strings.Contains(data, printText) {
globals.SugarLogger.Debugf("handleConn print callback: %v", data) //globals.SugarLogger.Debugf("handleConn print callback: %v", data)
changePrintMsg(data) //changePrintMsg(data)
} }
} }
} }
@@ -304,6 +304,14 @@ func doPrint(printMsgChanFail chan *model.PrintMsg) (err error) {
globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data)) globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data))
printMsg.Status = printMsgAlreadySend printMsg.Status = printMsgAlreadySend
dao.UpdateEntity(db, printMsg, "Status", "Comment") dao.UpdateEntity(db, printMsg, "Status", "Comment")
buffer := make([]byte, 1024)
n, _ := c.Read(buffer)
data := hex.EncodeToString(buffer[:n])
if strings.Contains(data, printText) {
globals.SugarLogger.Debugf("handleConn print callback: %v", data)
changePrintMsg(data)
}
} }
} }
} }