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