fix device
This commit is contained in:
parent
37123da219
commit
b7b25aa41f
@ -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 ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user