From 0e23d87c88c10d129d240e43796340345a478ee5 Mon Sep 17 00:00:00 2001 From: anlicheng Date: Mon, 4 Sep 2023 14:05:26 +0800 Subject: [PATCH] fix device status --- apps/iot/src/iot_device.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/iot/src/iot_device.erl b/apps/iot/src/iot_device.erl index 96753c4..19e8d4f 100644 --- a/apps/iot/src/iot_device.erl +++ b/apps/iot/src/iot_device.erl @@ -120,7 +120,7 @@ handle_event(cast, {change_status, ?DEVICE_ONLINE}, ?STATE_ACTIVATED, State = #s %% 改变数据库的状态, 其他情况下执行次数都很少 handle_event(cast, {change_status, NewStatus}, _, State = #state{device_uuid = DeviceUUID}) -> {ok, _} = device_bo:change_status(DeviceUUID, NewStatus), - {keep_state, State}; + {keep_state, State#state{status = NewStatus}}; %% 重新加载数据库数据 handle_event(cast, reload, _, State = #state{device_uuid = DeviceUUID}) -> @@ -136,7 +136,7 @@ handle_event(cast, reload, _, State = #state{device_uuid = DeviceUUID}) -> end; undefined -> lager:warning("[iot_device] device uuid: ~p, loaded from mysql failed", [DeviceUUID]), - {keep_state, State} + {stop, normal, State} end; %% 处理授权