diff --git a/src/main/java/com/iflytop/handacid/app/controller/DeviceController.java b/src/main/java/com/iflytop/handacid/app/controller/DeviceController.java index 9b5e1cd..44d6e91 100644 --- a/src/main/java/com/iflytop/handacid/app/controller/DeviceController.java +++ b/src/main/java/com/iflytop/handacid/app/controller/DeviceController.java @@ -1,6 +1,8 @@ package com.iflytop.handacid.app.controller; +import com.iflytop.handacid.app.core.state.ChannelState; import com.iflytop.handacid.app.core.state.DeviceState; +import com.iflytop.handacid.app.model.bo.SyncOperationsChannel; import com.iflytop.handacid.app.model.dto.SyncOperationsDTO; import com.iflytop.handacid.common.result.Result; import io.swagger.v3.oas.annotations.Operation; @@ -26,6 +28,12 @@ public class DeviceController { @Operation(summary = "同步用户操作") @PostMapping("/sync") public Result syncOperations(@RequestBody SyncOperationsDTO syncOperationsDTO) { - return Result.success(deviceState.toJSON()); + deviceState.setMode(syncOperationsDTO.getMode()); + for (SyncOperationsChannel syncOperationsChannel : syncOperationsDTO.getChannels()) { + ChannelState channelState = deviceState.getChannelStateMap().get(syncOperationsChannel.getChannelCode()); + channelState.setSelected(syncOperationsChannel.isSelected()); + channelState.setTargetVolume(syncOperationsChannel.getTargetVolume()); + } + return Result.success(); } }