From 89c4769b69ad9d7897aa3b00138903ff67a66226 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Thu, 29 Jul 2021 15:39:02 +0800 Subject: [PATCH] aa --- business/jxstore/event/event_tcp.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index a23ef12a0..0c3d61007 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -27,7 +27,7 @@ func ListenTcp() { go HandleTcpMessages() go t.HandleCheckTcpHeart() go t.doPrint2(printMsgChan) - //go t.doPrint(printMsgChanFail) + go t.doPrint(printMsgChanFail) for { c, err := l.Accept() if err != nil { @@ -95,7 +95,7 @@ func (t *TcpClient) handleConn(c net.Conn) { t.addConn(c, printNo, printStatus2JxStatus(data[len(data)-8:len(data)-6])) changePrinterStatus(printNo, status) if status == printerStatusOnline { - //printFail() + printFail() } } else { //改变打印机状态 @@ -151,7 +151,7 @@ func printFail() (err error) { var ( db = dao.GetDB() ) - prints, _ := dao.GetPrintMsgs(db, []int{printMsgWait, printMsgFail, printMsgErr, printMsgAlreadyLoad, printMsgAlreadySend}, time.Now().Add(-time.Hour*3), time.Now(), 0, 999) + prints, _ := dao.GetPrintMsgs(db, []int{printMsgFail, printMsgErr, printMsgAlreadyLoad, printMsgAlreadySend}, time.Now().Add(-time.Hour*3), time.Now(), 0, 999) for _, printMsg := range prints { printMsgChanFail <- printMsg } @@ -190,10 +190,14 @@ func (t *TcpClient) doPrint(printMsgChanFail chan *model.PrintMsg) (err error) { //c.Close() } else { globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data)) + dataStr := <-printMsgCallbackChan + t.changePrintMsg(dataStr) } } } } + default: + } } }