fix
This commit is contained in:
parent
4d2e053552
commit
8e575788f9
@ -118,6 +118,7 @@ handle_request("POST", "/host/activate", _, #{<<"uuid">> := UUID, <<"auth">> :=
|
|||||||
{ok, Pid} when is_pid(Pid) ->
|
{ok, Pid} when is_pid(Pid) ->
|
||||||
lager:debug("[host_handler] activate host_id: ~p, start", [UUID]),
|
lager:debug("[host_handler] activate host_id: ~p, start", [UUID]),
|
||||||
BinReply = jiffy:encode(#{<<"auth">> => true}, [force_utf8]),
|
BinReply = jiffy:encode(#{<<"auth">> => true}, [force_utf8]),
|
||||||
|
ok = iot_host:activate(Pid, true),
|
||||||
|
|
||||||
case iot_host:publish_message(Pid, 8, BinReply) of
|
case iot_host:publish_message(Pid, 8, BinReply) of
|
||||||
{ok, Ref} ->
|
{ok, Ref} ->
|
||||||
@ -125,7 +126,6 @@ handle_request("POST", "/host/activate", _, #{<<"uuid">> := UUID, <<"auth">> :=
|
|||||||
{response, Ref, Response} ->
|
{response, Ref, Response} ->
|
||||||
case jiffy:decode(Response, [return_maps]) of
|
case jiffy:decode(Response, [return_maps]) of
|
||||||
#{<<"code">> := 1} ->
|
#{<<"code">> := 1} ->
|
||||||
ok = iot_host:activate(Pid, true),
|
|
||||||
{ok, 200, iot_util:json_data(<<"success">>)};
|
{ok, 200, iot_util:json_data(<<"success">>)};
|
||||||
#{<<"code">> := 0, <<"message">> := Message} when is_binary(Message) ->
|
#{<<"code">> := 0, <<"message">> := Message} when is_binary(Message) ->
|
||||||
{ok, 200, iot_util:json_error(401, <<"操作失败: "/utf8, Message/binary>>)}
|
{ok, 200, iot_util:json_error(401, <<"操作失败: "/utf8, Message/binary>>)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user