From 8e575788f9474da16ba463c72b8533d7a05e02cb Mon Sep 17 00:00:00 2001 From: anlicheng Date: Wed, 9 Aug 2023 17:08:56 +0800 Subject: [PATCH] fix --- apps/iot/src/http_handler/host_handler.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/iot/src/http_handler/host_handler.erl b/apps/iot/src/http_handler/host_handler.erl index 290c023..744c639 100644 --- a/apps/iot/src/http_handler/host_handler.erl +++ b/apps/iot/src/http_handler/host_handler.erl @@ -118,6 +118,7 @@ handle_request("POST", "/host/activate", _, #{<<"uuid">> := UUID, <<"auth">> := {ok, Pid} when is_pid(Pid) -> lager:debug("[host_handler] activate host_id: ~p, start", [UUID]), BinReply = jiffy:encode(#{<<"auth">> => true}, [force_utf8]), + ok = iot_host:activate(Pid, true), case iot_host:publish_message(Pid, 8, BinReply) of {ok, Ref} -> @@ -125,7 +126,6 @@ handle_request("POST", "/host/activate", _, #{<<"uuid">> := UUID, <<"auth">> := {response, Ref, Response} -> case jiffy:decode(Response, [return_maps]) of #{<<"code">> := 1} -> - ok = iot_host:activate(Pid, true), {ok, 200, iot_util:json_data(<<"success">>)}; #{<<"code">> := 0, <<"message">> := Message} when is_binary(Message) -> {ok, 200, iot_util:json_error(401, <<"操作失败: "/utf8, Message/binary>>)}