This commit is contained in:
suyl
2021-07-22 15:03:53 +08:00
parent 68b6324365
commit c8678143c1

View File

@@ -372,7 +372,6 @@ func HandleTcpMessages() {
for _, printMsg := range prints { for _, printMsg := range prints {
printMsg.Status = printMsgAlreadyLoad printMsg.Status = printMsgAlreadyLoad
dao.UpdateEntity(db, printMsg, "Status") dao.UpdateEntity(db, printMsg, "Status")
} }
} }
} }
@@ -383,10 +382,7 @@ func doPrint2(printMsgChan chan *model.PrintMsg) (err error) {
) )
for { for {
select { select {
case data, _ := <-printMsgCallbackChan: case printMsg, _ := <-printMsgChan:
changePrintMsg(data)
default:
printMsg, _ := <-printMsgChan
var ( var (
data []byte data []byte
c net.Conn c net.Conn
@@ -429,6 +425,8 @@ func doPrint2(printMsgChan chan *model.PrintMsg) (err error) {
globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data)) globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data))
printMsg.Status = printMsgAlreadySend printMsg.Status = printMsgAlreadySend
dao.UpdateEntity(db, printMsg, "Status", "Comment") dao.UpdateEntity(db, printMsg, "Status", "Comment")
dataStr := <-printMsgCallbackChan
changePrintMsg(dataStr)
} }
} }
} }