From e7b8c7a5102954a4fffc225e3a917e08be24bb13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 1 Nov 2022 15:17:25 +0800 Subject: [PATCH] 1 --- business/jxstore/event/event_tcp.go | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index 92b695615..8c7ada6b4 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -65,15 +65,10 @@ func (t *TcpClient) handleConn(c net.Conn) { //} //看是心跳还是打印回调 data := hex.EncodeToString(buffer[:n]) - globals.SugarLogger.Debugf("===========n := %d", n) - globals.SugarLogger.Debugf("===========buffer := %s", string(buffer)) - globals.SugarLogger.Debugf("===========data := %s", data) //证明是心跳 if strings.Contains(data, heartText) || strings.Contains(data, heartTextNew) { - globals.SugarLogger.Debugf("handleConn heart: %v", data) printNoData, _ := hex.DecodeString(data[len(heartText) : len(data)-8]) printNo = string(printNoData) - globals.SugarLogger.Debugf("handleConn printno :[%v]", printNo) status := printStatus2JxStatus(data[len(data)-8 : len(data)-6]) //如果没在连接池里 //1、加到连接池中,不同的打印机no开不同的goroutine @@ -84,7 +79,6 @@ func (t *TcpClient) handleConn(c net.Conn) { //6、监听心跳时间,超过1分多钟就clear掉 //globals.SugarLogger.Debugf("handleConn timeout channel...: %v", t.TimeoutMap[printNo]) if t.Clients[printNo] == nil { - globals.SugarLogger.Debugf("==========print_no:%s", printNo) t.addConn(c, printNo, status) t.buildAllMap(printNo) t.HandleTcpMessages(printNo) @@ -104,19 +98,15 @@ func (t *TcpClient) handleConn(c net.Conn) { } //状态不一致再更新状态(可能缺纸了,过热了等) if t.getPrintStatus(printNo) != status { - globals.SugarLogger.Debugf("==========getPrintStatus:%s", printNo) t.setPrintStatus(printNo, status) changePrinterStatus(printNo, status) } - globals.SugarLogger.Debugf("handleConn print model %v", utils.Format4Output(t.Clients[printNo], true)) } else if strings.Contains(data, printText) || strings.Contains(data, printTextNew) { //打印回调 - globals.SugarLogger.Debugf("handleConn print callback: %v", data) //打印消息发送后,打印机会回调该条打印消息的状态(打印成功or失败,失败原因..) //将回调的信息放到回调channel中,打印成功后再打印下一条消息 _, printNo = getCallbackMsgInfo(data) //更新打印机心跳时间(打印机本身不会在打印的同时,或回调的同时发心跳消息,会导致心跳判断超时,这里更新一下) t.setPrintStatusTime(printNo) - globals.SugarLogger.Debugf("handleConn print callback statusTime: %v", t.Clients[printNo].StatusTime) t.addCallbackChan(printNo, data) } } @@ -206,7 +196,6 @@ func (t *TcpClient) doPrint(key string) (err error) { if !t.isExistMsg(key) { return err } - globals.SugarLogger.Debugf("doPrint printNo: %s", key) go func() { for { select { @@ -216,10 +205,6 @@ func (t *TcpClient) doPrint(key string) (err error) { default: select { case printMsg, ok := <-t.MsgMap[key]: - globals.SugarLogger.Debugf("printMsg == %s ,ok = %v", utils.Format4Output(printMsg, false), ok) - globals.SugarLogger.Debugf("printclien == %s", utils.Format4Output(t.Clients[printMsg.PrintNo], false)) - globals.SugarLogger.Debugf("printMsg == %s ,ok = %v", utils.Format4Output(printMsg, false), ok) - globals.SugarLogger.Debugf("printMsg == %s ,ok = %v", utils.Format4Output(printMsg, false), ok) if !ok { globals.SugarLogger.Debugf("doPrint err !ok ...") return @@ -246,7 +231,6 @@ func (t *TcpClient) doPrint(key string) (err error) { } } if err != nil { - globals.SugarLogger.Debugf("doPrint2 err printNo:%s, msgID:%s, err: %s", printMsg.PrintNo, printMsg.MsgID, err.Error()) //t.delConn(printMsg.PrintNo) printMsg.Status = printMsgErr printMsg.Comment = err.Error() @@ -266,9 +250,7 @@ func (t *TcpClient) doPrint(key string) (err error) { //t.delConn(printMsg.PrintNo) close(t.TimeoutMap[key]) } else { - globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data)) //等待回调 - globals.SugarLogger.Debugf("hui %v", hex.EncodeToString(data)) dataStr := <-t.CallBackMap[printMsg.PrintNo] if dataStr != "" { a, b := getCallbackMsgInfo(dataStr) @@ -327,7 +309,6 @@ func (t *TcpClient) HandleCheckTcpHeart(key string) { close(t.MsgMap[key]) close(t.CallBackMap[key]) delete(t.Clients, key) - globals.SugarLogger.Debugf("HandleCheckTcpHeart timeout") return default: statusTime := t.getPrintStatusTime(key) @@ -335,7 +316,6 @@ func (t *TcpClient) HandleCheckTcpHeart(key string) { //1分钟内没心跳判断打印机掉线了 if time.Now().Sub(statusTime) > time.Minute+time.Second*10 { changePrinterStatus(key, printerStatusOffline) - globals.SugarLogger.Debugf("HandleCheckTcpHeart clear...") //t.clear(key) close(t.TimeoutMap[key]) }