From e5322939b97646901529046c878bf45c7ef0ca3a Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Fri, 31 Oct 2025 14:47:23 +0800 Subject: [PATCH] remove unused code --- apps/iot/src/iot_device.erl | 1 - apps/iot/src/iot_host.erl | 2 -- apps/iot/src/iot_router.erl | 26 -------------------------- apps/iot/src/mocker/iot_mock.erl | 9 +-------- 4 files changed, 1 insertion(+), 37 deletions(-) delete mode 100644 apps/iot/src/iot_router.erl diff --git a/apps/iot/src/iot_device.erl b/apps/iot/src/iot_device.erl index 6296372..42096ce 100644 --- a/apps/iot/src/iot_device.erl +++ b/apps/iot/src/iot_device.erl @@ -122,5 +122,4 @@ report_event(DeviceUUID, NewStatus) when is_binary(DeviceUUID), is_integer(NewSt <<"name">> => <<"设备状态"/utf8>>, <<"timestamp">> => Timestamp }], - iot_router:route_uuid(DeviceUUID, FieldsList, Timestamp), lager:debug("[iot_device] device_uuid: ~p, route fields: ~p", [DeviceUUID, FieldsList]). \ No newline at end of file diff --git a/apps/iot/src/iot_host.erl b/apps/iot/src/iot_host.erl index 41569f1..957955e 100644 --- a/apps/iot/src/iot_host.erl +++ b/apps/iot/src/iot_host.erl @@ -481,8 +481,6 @@ report_event(UUID, NewStatus) when is_binary(UUID), is_integer(NewStatus) -> <<"name">> => <<"主机状态"/utf8>>, <<"timestamp">> => Timestamp }], - %% todo 这里需要实现新的机制 - % iot_router:route_uuid(UUID, FieldsList, Timestamp), lager:debug("[iot_host] host_uuid: ~p, route fields: ~p", [UUID, FieldsList]). %% 将当前的state转换成map diff --git a/apps/iot/src/iot_router.erl b/apps/iot/src/iot_router.erl deleted file mode 100644 index 9364ec6..0000000 --- a/apps/iot/src/iot_router.erl +++ /dev/null @@ -1,26 +0,0 @@ -%%%------------------------------------------------------------------- -%%% @author aresei -%%% @copyright (C) 2023, -%%% @doc -%%% -%%% @end -%%% Created : 04. 7月 2023 11:30 -%%%------------------------------------------------------------------- --module(iot_router). --author("aresei"). --include("iot.hrl"). - -%% API --export([route_uuid/3]). - --spec route_uuid(RouterUUID :: binary(), Fields :: list(), Timestamp :: integer()) -> no_return(). -route_uuid(RouterUUID, Fields, Timestamp) when is_binary(RouterUUID), is_list(Fields), is_integer(Timestamp) -> - %% 查找终端设备对应的点位信息 - case redis_client:hget(RouterUUID, <<"location_code">>) of - {ok, undefined} -> - lager:warning("[iot_host] the north_data hget location_code, uuid: ~p, not found, fields: ~p", [RouterUUID, Fields]); - {ok, LocationCode} when is_binary(LocationCode) -> - iot_zd_endpoint:forward(LocationCode, Fields, Timestamp); - {error, Reason} -> - lager:warning("[iot_host] the north_data hget location_code uuid: ~p, get error: ~p, fields: ~p", [RouterUUID, Reason, Fields]) - end. \ No newline at end of file diff --git a/apps/iot/src/mocker/iot_mock.erl b/apps/iot/src/mocker/iot_mock.erl index c5493c3..1968930 100644 --- a/apps/iot/src/mocker/iot_mock.erl +++ b/apps/iot/src/mocker/iot_mock.erl @@ -13,7 +13,7 @@ %% API -export([rsa_encode/1]). -export([insert_services/1]). --export([test_mqtt/0, test_influxdb/0]). +-export([test_influxdb/0]). test_influxdb() -> UUID = <<"device123123">>, @@ -29,13 +29,6 @@ test_influxdb() -> end) end, lists:seq(1, 100)). -test_mqtt() -> - iot_zd_endpoint:forward(<<"location_code_test123">>, [ - #{<<"key">> => <<"name">>, <<"value">> => <<"anlicheng">>}, - #{<<"key">> => <<"age">>, <<"value">> => 30}, - #{<<"key">> => <<"flow">>, <<"value">> => 30} - ], iot_util:timestamp_of_seconds()). - insert_services(Num) -> lists:foreach(fun(Id) -> Res = mysql_pool:insert(mysql_iot, <<"micro_service">>,