aa
This commit is contained in:
@@ -111,7 +111,7 @@ var (
|
|||||||
regexpQrr = regexp.MustCompile(byteSignQrRight + "(.*?)" + byteSignQrRightE)
|
regexpQrr = regexp.MustCompile(byteSignQrRight + "(.*?)" + byteSignQrRightE)
|
||||||
regexpSound = regexp.MustCompile(byteSignSound + "(.*?)" + byteSignSoundE)
|
regexpSound = regexp.MustCompile(byteSignSound + "(.*?)" + byteSignSoundE)
|
||||||
|
|
||||||
printMsgChan = make(chan *model.PrintMsg)
|
printMsgChan = make(chan interface{})
|
||||||
printMsgChanFail = make(chan *model.PrintMsg)
|
printMsgChanFail = make(chan *model.PrintMsg)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -227,7 +227,8 @@ func handleConn(c net.Conn) {
|
|||||||
}
|
}
|
||||||
} else if strings.Contains(data, printText) {
|
} else if strings.Contains(data, printText) {
|
||||||
globals.SugarLogger.Debugf("handleConn print callback: %v", data)
|
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 (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
)
|
)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case printMsg, _ := <-printMsgChan:
|
case obj, _ := <-printMsgChan:
|
||||||
|
printMsg, ok := obj.(*model.PrintMsg)
|
||||||
|
if ok {
|
||||||
var (
|
var (
|
||||||
data []byte
|
data []byte
|
||||||
c net.Conn
|
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