This commit is contained in:
suyl
2021-07-30 18:10:21 +08:00
parent 922b3ab1d2
commit a1201f8fc9
2 changed files with 6 additions and 2 deletions

View File

@@ -97,7 +97,7 @@ func (t *TcpClient) handleConn(c net.Conn) {
//t.buildCallBackMap(printNo) //t.buildCallBackMap(printNo)
//t.buildMsgMap(printNo) //t.buildMsgMap(printNo)
t.HandleTcpMessages(printNo) t.HandleTcpMessages(printNo)
t.doPrint2(printNo) t.doPrint(printNo)
if status == printerStatusOnline { if status == printerStatusOnline {
t.printFail() t.printFail()
} }
@@ -224,6 +224,7 @@ func (t *TcpClient) HandleTcpMessages(printNo string) {
db = dao.GetDB() db = dao.GetDB()
offset, pageSize = 0, 1 offset, pageSize = 0, 1
) )
globals.SugarLogger.Debugf("build HandleTcpMessages printNo: %s", printNo)
go func(key string) { go func(key string) {
for { for {
//一直读? //一直读?
@@ -237,10 +238,11 @@ func (t *TcpClient) HandleTcpMessages(printNo string) {
}(printNo) }(printNo)
} }
func (t *TcpClient) doPrint2(key string) (err error) { func (t *TcpClient) doPrint(key string) (err error) {
var ( var (
db = dao.GetDB() db = dao.GetDB()
) )
globals.SugarLogger.Debugf("doPrint printNo: %s", key)
if !t.isExistMsg(key) { if !t.isExistMsg(key) {
return err return err
} }

View File

@@ -2,6 +2,7 @@ package event
import ( import (
"git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals"
"net" "net"
"regexp" "regexp"
"sync" "sync"
@@ -138,6 +139,7 @@ func (t *TcpClient) delConn(key string) {
func (t *TcpClient) addConn(c net.Conn, key string, status int) { func (t *TcpClient) addConn(c net.Conn, key string, status int) {
t.Lock() t.Lock()
defer t.Unlock() defer t.Unlock()
globals.SugarLogger.Debugf("addConn key: %s", key)
t.Clients[key] = &PrintInfo{ t.Clients[key] = &PrintInfo{
C: c, C: c,
Status: status, Status: status,