This commit is contained in:
suyl
2021-06-29 10:41:54 +08:00
parent 688bd6e363
commit 92aba744ff

View File

@@ -147,7 +147,6 @@ func HandleTcpMessages() {
var (
db = dao.GetDB()
offset, pageSize = 0, 10
c net.Conn
data []byte
)
for {
@@ -156,15 +155,13 @@ func HandleTcpMessages() {
time.Sleep(time.Second / 2)
prints, _ := dao.GetPrintMsgs(db, printMsgWait, offset, pageSize)
for _, printMsg := range prints {
var c net.Conn
if printMsg != nil {
if err = checkPrintMsg(printMsg); err == nil {
fmt.Println("11111111111111111111", tcpClient.Clients[printMsg.PrintNo])
if tcpClient.Clients[printMsg.PrintNo] != nil {
c = tcpClient.Clients[printMsg.PrintNo]
data, err = buildMsg(printMsg)
fmt.Println("2222222222222222222222222222222222")
} else {
fmt.Println("33333333333333333333333333333333333333")
changePrinterStatus(printMsg.PrintNo, printerStatusOffline)
}
}
@@ -179,7 +176,6 @@ func HandleTcpMessages() {
c.Close()
} else {
if c != nil {
fmt.Println("4444444444444444444444444444444444444")
if _, err = c.Write(data); err != nil {
globals.SugarLogger.Debugf("handleTcpMessages err [%v]", err)
delete(tcpClient.Clients, printMsg.PrintNo)