fix device

This commit is contained in:
anlicheng 2023-08-17 15:35:11 +08:00
parent 37123da219
commit b7b25aa41f

View File

@ -18,7 +18,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
handle_request("POST", "/device/reload", _, #{<<"host_id">> := HostId, <<"device_uuid">> := DeviceUUID}) when is_binary(DeviceUUID) -> handle_request("POST", "/device/reload", _, #{<<"host_id">> := HostId, <<"device_uuid">> := DeviceUUID}) when is_integer(HostId), is_binary(DeviceUUID) ->
lager:debug("[device_handler] host_id: ~p, will reload device uuid: ~p", [HostId, DeviceUUID]), lager:debug("[device_handler] host_id: ~p, will reload device uuid: ~p", [HostId, DeviceUUID]),
AliasName = iot_host:get_alias_name(HostId), AliasName = iot_host:get_alias_name(HostId),
case global:whereis_name(AliasName) of case global:whereis_name(AliasName) of
@ -35,7 +35,7 @@ handle_request("POST", "/device/reload", _, #{<<"host_id">> := HostId, <<"device
end; end;
%% %%
handle_request("POST", "/device/delete", _, #{<<"host_id">> := HostId, <<"device_uuid">> := DeviceUUID}) when is_binary(DeviceUUID) -> handle_request("POST", "/device/delete", _, #{<<"host_id">> := HostId, <<"device_uuid">> := DeviceUUID}) when is_integer(HostId), is_binary(DeviceUUID) ->
AliasName = iot_host:get_alias_name(HostId), AliasName = iot_host:get_alias_name(HostId),
case global:whereis_name(AliasName) of case global:whereis_name(AliasName) of
undefined -> undefined ->
@ -46,7 +46,9 @@ handle_request("POST", "/device/delete", _, #{<<"host_id">> := HostId, <<"device
end; end;
%% %%
handle_request("POST", "/device/activate", _, #{<<"host_id">> := HostId, <<"device_uuid">> := DeviceUUID, <<"auth">> := Auth}) when is_binary(DeviceUUID) -> handle_request("POST", "/device/activate", _, #{<<"host_id">> := HostId, <<"device_uuid">> := DeviceUUID, <<"auth">> := Auth})
when is_integer(HostId), is_binary(DeviceUUID), is_boolean(Auth) ->
AliasName = iot_host:get_alias_name(HostId), AliasName = iot_host:get_alias_name(HostId),
case global:whereis_name(AliasName) of case global:whereis_name(AliasName) of
undefined -> undefined ->