aa
This commit is contained in:
@@ -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)
|
prints, _ := dao.GetPrintMsgs(db, printNo, []int{printMsgWait}, time.Now().Add(-time.Hour*3), time.Now(), offset, pageSize)
|
||||||
for _, printMsg := range prints {
|
for _, printMsg := range prints {
|
||||||
t.addMsgChan(printMsg)
|
|
||||||
printMsg.Status = printMsgAlreadyLoad
|
printMsg.Status = printMsgAlreadyLoad
|
||||||
dao.UpdateEntity(db, printMsg, "Status")
|
dao.UpdateEntity(db, printMsg, "Status")
|
||||||
|
t.addMsgChan(printMsg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@@ -219,11 +219,13 @@ func (t *TcpClient) doPrint(key string) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//检测心跳
|
||||||
func (t *TcpClient) HandleCheckTcpHeart(key string) {
|
func (t *TcpClient) HandleCheckTcpHeart(key string) {
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
if !utils.IsTimeZero(t.getPrintStatusTime(key)) {
|
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)
|
changePrinterStatus(key, printerStatusOffline)
|
||||||
if t.isExist(key) {
|
if t.isExist(key) {
|
||||||
globals.SugarLogger.Debugf("HandleCheckTcpHeart del key,%v", key)
|
globals.SugarLogger.Debugf("HandleCheckTcpHeart del key,%v", key)
|
||||||
|
|||||||
Reference in New Issue
Block a user