%%%------------------------------------------------------------------- %%% @author anlicheng %%% @copyright (C) 2024, %%% @doc %%% %%% @end %%% Created : 09. 4月 2024 14:28 %%%------------------------------------------------------------------- -module(node_handler). -author("anlicheng"). %% API -export([handle_request/4]). handle_request("POST", "/node/disable", _, #{<<"network_id">> := NetworkId, <<"client_id">> := ClientId}) when NetworkId > 0 -> case sdlan_network:get_pid(NetworkId) of undefined -> {ok, 200, sdlan_util:json_error(-1, <<"network not found">>)}; Pid -> sdlan_network:disable_client(Pid, ClientId), {ok, 200, sdlan_util:json_data(<<"success">>)} end; handle_request(_, Path, _, _) -> Path1 = list_to_binary(Path), {ok, 200, sdlan_util:json_error(-1, <<"url: ", Path1/binary, " not found">>)}.