Browse Source

关机无记录数据2

bzd_lkh 1 month ago
parent
commit
59b44cd0a2
1 changed files with 2 additions and 1 deletions
  1. 2 1
      MqttServer/MqttClients.go

+ 2 - 1
MqttServer/MqttClients.go

@@ -8,6 +8,7 @@ import (
 	"Cold_mqtt/models/Device"
 	"Cold_mqtt/models/Warning"
 	"encoding/json"
+	"strconv"
 	"strings"
 	"time"
 )
@@ -190,7 +191,7 @@ func MessageDisconnected(topicName string, message []byte) {
 			DeviceSensorList := Device.Read_DeviceSensor_ByTsn(r_Device.T_sn)
 			logs.Println("DeviceSensorList:", DeviceSensorList)
 			for _, v := range DeviceSensorList {
-				DeviceData_t, is := Device.RedisDeviceData_Get(r_Device.T_sn+"_Redis", v.T_id)
+				DeviceData_t, is := Device.RedisDeviceData_Get(r_Device.T_sn+"_Redis|"+strconv.Itoa(v.T_id), v.T_id)
 				logs.Println("DeviceData_t is:", is)
 				if is {
 					Device.Add_DeviceData(r_Device.T_sn, v.T_id, DeviceData_t, true)