add tests
This commit is contained in:
parent
5f66983633
commit
490894620b
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
%% API
|
%% API
|
||||||
-export([route_uuid/3]).
|
-export([route_uuid/3]).
|
||||||
|
-export([set_tests/1]).
|
||||||
|
|
||||||
-spec route_uuid(RouterUUID :: binary(), EventType :: integer(), Params :: map()) -> no_return().
|
-spec route_uuid(RouterUUID :: binary(), EventType :: integer(), Params :: map()) -> no_return().
|
||||||
route_uuid(RouterUUID, EventType, Params) when is_binary(RouterUUID), is_integer(EventType), is_map(Params) ->
|
route_uuid(RouterUUID, EventType, Params) when is_binary(RouterUUID), is_integer(EventType), is_map(Params) ->
|
||||||
@ -21,10 +22,19 @@ route_uuid(RouterUUID, EventType, Params) when is_binary(RouterUUID), is_integer
|
|||||||
lager:debug("[iot_ai_router] hget uuid: ~p, location_code: ~p", [RouterUUID, LocationCode]),
|
lager:debug("[iot_ai_router] hget uuid: ~p, location_code: ~p", [RouterUUID, LocationCode]),
|
||||||
%% 动火离人推送给金智 2024-12-02, 2边都要推送
|
%% 动火离人推送给金智 2024-12-02, 2边都要推送
|
||||||
lists:member(EventType, [15]) andalso iot_donghuoliren_endpoint:forward(LocationCode, DynamicLocationCode, EventType, Params),
|
lists:member(EventType, [15]) andalso iot_donghuoliren_endpoint:forward(LocationCode, DynamicLocationCode, EventType, Params),
|
||||||
%% 动火离人推送给金智 2024-03-21
|
|
||||||
|
TestEventTypes = application:get_env(iot, test_event_types, []),
|
||||||
|
case lists:member(EventType, TestEventTypes) of
|
||||||
|
true ->
|
||||||
|
lager:debug("[iot_ai_router] event_type: ~p, is test", [EventType]);
|
||||||
|
false ->
|
||||||
iot_jinzhi_endpoint:forward(LocationCode, DynamicLocationCode, EventType, Params);
|
iot_jinzhi_endpoint:forward(LocationCode, DynamicLocationCode, EventType, Params);
|
||||||
|
end;
|
||||||
{ok, _} ->
|
{ok, _} ->
|
||||||
lager:debug("[iot_ai_router] hget location_code, uuid: ~p, not found", [RouterUUID]);
|
lager:debug("[iot_ai_router] hget location_code, uuid: ~p, not found", [RouterUUID]);
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
lager:debug("[iot_ai_router] hget location_code uuid: ~p, get error: ~p", [RouterUUID, Reason])
|
lager:debug("[iot_ai_router] hget location_code uuid: ~p, get error: ~p", [RouterUUID, Reason])
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
set_tests(TestEventTypes) when is_list(TestEventTypes) ->
|
||||||
|
application:set_env(iot, test_event_types, TestEventTypes).
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user