From 15be60ca082cbbf13b49abf388c30c14e600a310 Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Tue, 12 Aug 2025 18:06:11 +0800 Subject: [PATCH] fix --- apps/iot/src/http/endpoint_handler.erl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/iot/src/http/endpoint_handler.erl b/apps/iot/src/http/endpoint_handler.erl index e5a2a7a..18ea043 100644 --- a/apps/iot/src/http/endpoint_handler.erl +++ b/apps/iot/src/http/endpoint_handler.erl @@ -17,6 +17,18 @@ %% helper methods %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% 获取endpoint的运行状态 +handle_request("POST", "/endpoint/run_statuses", _, Ids) when is_list(Ids) -> + Statuses = lists:map(fun(Id) -> + case endpoint:get_pid(Id) of + undefined -> + 0; + Pid when is_pid(Pid) -> + 1 + end + end, Ids), + {ok, 200, iot_util:json_data(Statuses)}; + handle_request("POST", "/endpoint/start", _, #{<<"id">> := Id}) when is_integer(Id) -> case endpoint_bo:get_endpoint(Id) of undefined ->