From a1851188ad6435b9af924f27e368bbf1b56da84b Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Tue, 29 Jun 2021 10:19:58 +0800 Subject: [PATCH] test --- business/jxstore/event/event_tcp.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index 704c94ebf..90fdc4c0f 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -3,7 +3,6 @@ package event import ( "encoding/hex" "fmt" - "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxutils" "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model/dao" @@ -57,7 +56,7 @@ func ListenTcp() { return } globals.SugarLogger.Debugf("begin listenTcp port 8000......") - go HandleTcpMessages() + //go HandleTcpMessages() for { c, err := l.Accept() if err != nil { @@ -88,10 +87,8 @@ func handleConn(c net.Conn) { } return } - globals.SugarLogger.Debugf("handleConn map: [%v]", utils.Format4Output(tcpClient.Clients, false)) //看是心跳还是打印返回 data := hex.EncodeToString(buffer[:n]) - globals.SugarLogger.Debugf("handleConn heart : [%v]", data) //证明是心跳 if strings.Contains(data, heartText) { printNoData, _ := hex.DecodeString(data[len(heartText) : len(data)-8]) @@ -130,12 +127,15 @@ func changePrintMsg(data string) (err error) { status = printMsgFail comment = printErrMap[data[12:14]] } + if tcpClient.Clients[printNo] == nil { + return err + } if printMsg, err = dao.GetPrintMsg(db, printNo, orderNo); err != nil { globals.SugarLogger.Debugf("changePrintMsg err :[%v]", err) return } else if printMsg == nil { globals.SugarLogger.Debugf("changePrintMsg err ,not found printMsg printNo:[%v], orderNo :[%v]", printNo, orderNo) - } else { + } else if printMsg.Status != status { printMsg.Comment = comment printMsg.Status = status dao.UpdateEntity(db, printMsg, "Comment", "Status")