diff --git a/backend/internal/handler/handler.go b/backend/internal/handler/handler.go index 6dab31f..31cb10b 100644 --- a/backend/internal/handler/handler.go +++ b/backend/internal/handler/handler.go @@ -771,18 +771,18 @@ func GetAllDeviceStatus(c *gin.Context) { allDevices := deviceStorage.GetDevices() // 查询每个设备的状态 - result := make([]map[string]interface{}, 0, len(allDevices)) - for _, device := range allDevices { - // 查询设备监控数据 - _, status, _ := globalStorage.QueryDeviceStatus(context.Background(), device.ID) + result := make([]map[string]interface{}, 0, len(allDevices)) + for _, device := range allDevices { + // 查询设备监控数据 + _, status, _ := globalStorage.QueryDeviceStatus(context.Background(), device.ID) - // 总是返回设备信息,无论是否有监控数据 - result = append(result, map[string]interface{}{ - "device_id": device.ID, - "name": device.Name, - "status": status, - }) - } + // 总是返回设备信息,无论是否有监控数据 + result = append(result, map[string]interface{}{ + "id": device.ID, + "name": device.Name, + "status": status, + }) + } c.JSON(http.StatusOK, gin.H{ "devices": result, diff --git a/backend/monitor-server b/backend/monitor-server index a059939..02631dd 100755 Binary files a/backend/monitor-server and b/backend/monitor-server differ diff --git a/backend/static/index.html b/backend/static/index.html index db092ce..b5b9473 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -197,7 +197,7 @@