1
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user