新增处理

This commit is contained in:
2024-12-24 14:10:09 +08:00
parent 2a2e15c3d0
commit 792679098c

View File

@@ -46,6 +46,7 @@ func (h *TCPHandler) HandleClient(conn net.Conn) {
output = strings.ReplaceAll(output, "\n", "")
message = []byte(output)
fmt.Printf("收到消息来自 %s: %s\n", conn.RemoteAddr(), message)
if !json.Valid(message) {
fmt.Printf("来自客户端的数据非法 %s\n", conn.RemoteAddr())
conn.Close()
@@ -252,7 +253,6 @@ func (s *Server) StopRealTimeReporting(client *Client, message []byte) error {
return nil
}
// TimingReporting 定时上报数据
func (s *Server) TimingReporting(client *Client, message []byte) error {
var msg Message
if err := json.Unmarshal(message, &msg); err != nil {