This commit is contained in:
邹宗楠
2023-02-03 14:29:48 +08:00
parent 942f9f93b4
commit aedff383c6
2 changed files with 38 additions and 10 deletions

View File

@@ -162,6 +162,31 @@ func (t *TcpClient) changePrintMsg(data string, orderNo int64, printNo string) (
return err
}
//
//var (
// printClient = make(map[string]*TcpClient, 0)
// db = dao.GetDB()
// offset, pageSize = 0, 100
//)
//
//func init() {
// go func() {
// for {
// if time.Now().Unix()%2 != 0 {
// continue
// }
// for printNo, PrintTcpClient := range printClient {
// if !PrintTcpClient.isExistMsg(printNo) {
// return
// }
//
// }
//
// }
// }()
//
//}
func (t *TcpClient) HandleTcpMessages(printNo string) {
var (
db = dao.GetDB()
@@ -170,10 +195,8 @@ func (t *TcpClient) HandleTcpMessages(printNo string) {
if !t.isExistMsg(printNo) {
return
}
go func() {
for {
select {
case <-t.TimeoutMap[printNo]:
globals.SugarLogger.Debugf("HandleTcpMessages timeout")
@@ -253,13 +276,13 @@ func (t *TcpClient) doPrint(key string) (err error) {
close(t.TimeoutMap[key])
} else {
if c != nil {
encryption := ""
for _, v := range data {
encryption += fmt.Sprintf("%d", v)
}
printMsg.ContentEncryption = encryption
dao.UpdateEntity(db, printMsg, "ContentEncryption")
//encryption := ""
//for _, v := range data {
// encryption += fmt.Sprintf("%d", v)
//}
//printMsg.ContentEncryption = encryption
//
//dao.UpdateEntity(db, printMsg, "ContentEncryption")
if _, err = c.Write(data); err != nil {
globals.SugarLogger.Debugf("handleTcpMessages err [%v]", err)
//t.delConn(printMsg.PrintNo)