From fef8247944b07bc29f37393022889d0385c4d121 Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Sat, 28 Feb 2026 13:49:22 +0800 Subject: [PATCH] fix binlog --- .../sdlan/src/http_handler/binlog_handler.erl | 30 +++++++++++++++++++ apps/sdlan/src/sdlan_app.erl | 1 + 2 files changed, 31 insertions(+) create mode 100644 apps/sdlan/src/http_handler/binlog_handler.erl diff --git a/apps/sdlan/src/http_handler/binlog_handler.erl b/apps/sdlan/src/http_handler/binlog_handler.erl new file mode 100644 index 0000000..e5d3bd1 --- /dev/null +++ b/apps/sdlan/src/http_handler/binlog_handler.erl @@ -0,0 +1,30 @@ +%%%------------------------------------------------------------------- +%%% @author licheng5 +%%% @copyright (C) 2020, +%%% @doc +%%% +%%% @end +%%% Created : 26. 4月 2020 3:36 下午 +%%%------------------------------------------------------------------- +-module(binlog_handler). +-author("licheng5"). + +%% API +-export([handle_request/4]). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% helper methods +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% 重新加载对应的主机信息 +handle_request("POST", "/binlog", _, PostParams) -> + logger:debug("[binlog_handler] get post params: ~p", [PostParams]), + {ok, 200, sdlan_util:json_data(<<"ok">>)}; + +handle_request(_, Path, _, _) -> + Path1 = list_to_binary(Path), + {ok, 200, sdlan_util:json_error(-1, <<"url: ", Path1/binary, " not found">>)}. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% helper methods +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ No newline at end of file diff --git a/apps/sdlan/src/sdlan_app.erl b/apps/sdlan/src/sdlan_app.erl index 627b22a..1eec382 100644 --- a/apps/sdlan/src/sdlan_app.erl +++ b/apps/sdlan/src/sdlan_app.erl @@ -38,6 +38,7 @@ start_http_server() -> Dispatcher = cowboy_router:compile([ {'_', [ {"/api/[...]", http_protocol, [api_handler]}, + {"/binlog", http_protocol, [binlog_handler]}, {"/network/[...]", http_protocol, [network_handler]}, {"/node/[...]", http_protocol, [node_handler]}, {"/test/[...]", http_protocol, [test_handler]}