fix:修改解析函数
This commit is contained in:
parent
63cee9c09c
commit
3d58223306
@ -192,7 +192,7 @@ func (h *SensorHandler) GetLatestSensorRawData(w http.ResponseWriter, r *http.Re
|
||||
Temperature float64 `json:"temperature"` // 温度(℃)
|
||||
AtmPressure float64 `json:"atm_pressure"` // 大气压(kPa)
|
||||
SolarRadiation int `json:"solar_radiation"` // 太阳辐射(W/m²)
|
||||
Rainfall int `json:"rainfall"` // 累计雨量(mm)
|
||||
Rainfall float64 `json:"rainfall"` // 累计雨量(mm)
|
||||
}{
|
||||
ID: data.ID,
|
||||
Timestamp: data.Timestamp,
|
||||
@ -205,7 +205,7 @@ func (h *SensorHandler) GetLatestSensorRawData(w http.ResponseWriter, r *http.Re
|
||||
Temperature: float64(data.Temperature) / 10.0,
|
||||
AtmPressure: float64(data.AtmPressure) / 10.0,
|
||||
SolarRadiation: data.SolarRadiation,
|
||||
Rainfall: data.OpticalRain,
|
||||
Rainfall: float64(data.OpticalRain) / 10.0,
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user