aa
This commit is contained in:
@@ -111,7 +111,7 @@ var (
|
||||
regexpQrr = regexp.MustCompile(byteSignQrRight + "(.*?)" + byteSignQrRightE)
|
||||
regexpSound = regexp.MustCompile(byteSignSound + "(.*?)" + byteSignSoundE)
|
||||
|
||||
printMsgChan = make(chan *model.PrintMsg)
|
||||
printMsgChan = make(chan interface{})
|
||||
printMsgChanFail = make(chan *model.PrintMsg)
|
||||
)
|
||||
|
||||
@@ -227,7 +227,8 @@ func handleConn(c net.Conn) {
|
||||
}
|
||||
} else if strings.Contains(data, printText) {
|
||||
globals.SugarLogger.Debugf("handleConn print callback: %v", data)
|
||||
changePrintMsg(data)
|
||||
printMsgChan <- data
|
||||
//changePrintMsg(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -375,13 +376,15 @@ func HandleTcpMessages() {
|
||||
}
|
||||
}
|
||||
|
||||
func doPrint2(printMsgChan chan *model.PrintMsg) (err error) {
|
||||
func doPrint2(printMsgChan chan interface{}) (err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
for {
|
||||
select {
|
||||
case printMsg, _ := <-printMsgChan:
|
||||
case obj, _ := <-printMsgChan:
|
||||
printMsg, ok := obj.(*model.PrintMsg)
|
||||
if ok {
|
||||
var (
|
||||
data []byte
|
||||
c net.Conn
|
||||
@@ -427,6 +430,11 @@ func doPrint2(printMsgChan chan *model.PrintMsg) (err error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
data, _ := <-printMsgChan
|
||||
dataStr := data.(string)
|
||||
changePrintMsg(dataStr)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user