From f71142b9150be80e445d770e824e7732f05b1d77 Mon Sep 17 00:00:00 2001 From: anlicheng Date: Wed, 9 Aug 2023 17:16:42 +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 744c639..290c023 100644 --- a/apps/iot/src/http_handler/host_handler.erl +++ b/apps/iot/src/http_handler/host_handler.erl @@ -118,7 +118,6 @@ 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} -> @@ -126,6 +125,7 @@ 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>>)}