This commit is contained in:
suyl
2021-08-02 15:48:06 +08:00
parent 35eddc42a6
commit 63b9692adb

View File

@@ -153,9 +153,9 @@ func (t *TcpClient) HandleTcpMessages(printNo string) {
//一直读?
prints, _ := dao.GetPrintMsgs(db, printNo, []int{printMsgWait}, time.Now().Add(-time.Hour*3), time.Now(), offset, pageSize)
for _, printMsg := range prints {
t.addMsgChan(printMsg)
printMsg.Status = printMsgAlreadyLoad
dao.UpdateEntity(db, printMsg, "Status")
t.addMsgChan(printMsg)
}
}
}()
@@ -219,11 +219,13 @@ func (t *TcpClient) doPrint(key string) (err error) {
return err
}
//检测心跳
func (t *TcpClient) HandleCheckTcpHeart(key string) {
go func() {
for {
if !utils.IsTimeZero(t.getPrintStatusTime(key)) {
if time.Now().Sub(t.getPrintStatusTime(key)) > time.Minute*3 {
//2分钟内没心跳判断打印机掉线了
if time.Now().Sub(t.getPrintStatusTime(key)) > time.Minute*2 {
changePrinterStatus(key, printerStatusOffline)
if t.isExist(key) {
globals.SugarLogger.Debugf("HandleCheckTcpHeart del key,%v", key)