fix fake_locations_code jinzhi

This commit is contained in:
anlicheng 2025-03-21 16:59:58 +08:00
parent 8adff02bd3
commit edb106907b
3 changed files with 27 additions and 8 deletions

View File

@ -189,7 +189,7 @@ format_event(LocationCode, DynamicLocationCode, EventType, #{<<"event_code">> :=
% <<"occurrenceTime">> => <<"2023-06-10 12:00:00">>, % <<"occurrenceTime">> => <<"2023-06-10 12:00:00">>,
LocationCode1 = fake_location_code(EventCode, LocationCode), LocationCode1 = fake_location_code(EventType, LocationCode),
DeviceInfo = #{ DeviceInfo = #{
% <<"location">> => LocationCode, % <<"location">> => LocationCode,
<<"location">> => LocationCode1, <<"location">> => LocationCode1,
@ -267,7 +267,8 @@ serialize0([{K, V}|T], Target) ->
serialize0(T, [Item|Target]). serialize0(T, [Item|Target]).
fake_location_code(EventCode, LocationCode) when is_binary(EventCode), is_binary(LocationCode) -> -spec fake_location_code(EventType :: integer(), LocationCode :: binary()) -> binary().
fake_location_code(EventType, LocationCode) when is_integer(EventType), is_binary(LocationCode) ->
% TODO delete % TODO delete
FakeLocationCodes = application:get_env(iot, fake_location_codes, []), FakeLocationCodes = application:get_env(iot, fake_location_codes, []),
proplists:get_value(EventCode, FakeLocationCodes, LocationCode). proplists:get_value(EventType, FakeLocationCodes, LocationCode).

View File

@ -19,6 +19,19 @@
15 => 300 15 => 300
}}, }},
{fake_location_codes, [
%% 鼠类监测
{11, <<"0508103010001050300001">>},
%% 异物占道
{13, <<"0512104030001050400003">>},
%% 垃圾箱(桶)
{14, <<"0507106030001050600003">>},
%% 操作区人员着装不规范
{12, <<"0500000000001022700537">>},
%% 动火离人
{15, <<"0500000000001022700538">>}
]},
{api_url, "http://39.98.184.67:8800"}, {api_url, "http://39.98.184.67:8800"},
{watchdog, [ {watchdog, [

View File

@ -20,11 +20,16 @@
}}, }},
{fake_location_codes, [ {fake_location_codes, [
{<<"23103">>, <<"0508103010001050300001">>}, %% 鼠类监测
{<<"20407">>, <<"0512104030001050400003">>}, {11, <<"0508103010001050300001">>},
{<<"10404">>, <<"0507106030001050600003">>}, %% 异物占道
{<<"22503">>, <<"0500000000001022700537">>}, {13, <<"0512104030001050400003">>},
{<<"23104">>, <<"0500000000001022700538">>} %% 垃圾箱(桶)
{14, <<"0507106030001050600003">>},
%% 操作区人员着装不规范
{12, <<"0500000000001022700537">>},
%% 动火离人
{15, <<"0500000000001022700538">>}
]}, ]},
{watchdog, [ {watchdog, [