From b29bdba37f8de65a53ed28ca98c7e12865a14a11 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Thu, 29 Jul 2021 15:43:38 +0800 Subject: [PATCH] aa --- business/jxstore/event/event_tcp.go | 48 ++--------------------------- 1 file changed, 2 insertions(+), 46 deletions(-) diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index 0c3d61007..c2f4242f4 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 { @@ -153,55 +153,11 @@ func printFail() (err error) { ) 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 + printMsgChan <- printMsg } return err } -func (t *TcpClient) doPrint(printMsgChanFail chan *model.PrintMsg) (err error) { - var ( - db = dao.GetDB() - ) - for { - select { - case printMsg, _ := <-printMsgChanFail: - var ( - data []byte - c net.Conn - ) - if printMsg != nil { - if err = checkPrintMsg(db, printMsg); err == nil { - //t.Lock() - //if t.Clients[printMsg.PrintNo] != nil { - // if t.Clients[printMsg.PrintNo].Status == printerStatusOnline { - // if t.Clients[printMsg.PrintNo].C != nil { - // c = t.Clients[printMsg.PrintNo].C - // data, err = buildMsg(printMsg) - // } - // } - //} - //t.Unlock() - if c = t.getPrintConn(printMsg.PrintNo); c != nil { - data, err = buildMsg(printMsg) - if _, err = c.Write(data); err != nil { - globals.SugarLogger.Debugf("handleTcpMessages err [%v]", err) - t.delConn(printMsg.PrintNo) - //delete(t.Clients, printMsg.PrintNo) - //c.Close() - } else { - globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data)) - dataStr := <-printMsgCallbackChan - t.changePrintMsg(dataStr) - } - } - } - } - default: - - } - } -} - func printStatus2JxStatus(printStatus string) (status int) { if printStatus == heartErrWithoutPaper { return printerStatusOnlineWithoutPaper