1
This commit is contained in:
@@ -2,6 +2,7 @@ package event
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
@@ -55,11 +56,16 @@ func (t *TcpClient) handleConn(c net.Conn) {
|
||||
|
||||
//看是心跳还是打印回调
|
||||
data := hex.EncodeToString(buffer[:n])
|
||||
globals.SugarLogger.Debugf("====================data %s", data)
|
||||
globals.SugarLogger.Debugf("====================data %s", string(buffer[:n]))
|
||||
if strings.Contains(string(buffer[0:n]), "print_no") {
|
||||
_, err := c.Write([]byte("ok"))
|
||||
globals.SugarLogger.Debugf("errr %v", err)
|
||||
if strings.Contains(string(buffer[0:n]), "print_no") { // 清理缓存
|
||||
param := struct {
|
||||
PrintNo string `json:"print_no"`
|
||||
}{}
|
||||
if err := json.Unmarshal(buffer[0:n], ¶m); err != nil {
|
||||
c.Write([]byte("err Unmarshal"))
|
||||
return
|
||||
}
|
||||
t.buildMsgMap(param.PrintNo)
|
||||
c.Write([]byte("ok"))
|
||||
return
|
||||
}
|
||||
//证明是心跳
|
||||
|
||||
Reference in New Issue
Block a user