From edb106907b7610dd0ba896ef96d113d0218b9cf0 Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Fri, 21 Mar 2025 16:59:58 +0800 Subject: [PATCH] fix fake_locations_code jinzhi --- apps/iot/src/endpoint/iot_jinzhi_endpoint.erl | 7 ++++--- config/sys-dev.config | 13 +++++++++++++ config/sys-prod.config | 15 ++++++++++----- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/apps/iot/src/endpoint/iot_jinzhi_endpoint.erl b/apps/iot/src/endpoint/iot_jinzhi_endpoint.erl index 567ed69..e478fd3 100644 --- a/apps/iot/src/endpoint/iot_jinzhi_endpoint.erl +++ b/apps/iot/src/endpoint/iot_jinzhi_endpoint.erl @@ -189,7 +189,7 @@ format_event(LocationCode, DynamicLocationCode, EventType, #{<<"event_code">> := % <<"occurrenceTime">> => <<"2023-06-10 12:00:00">>, - LocationCode1 = fake_location_code(EventCode, LocationCode), + LocationCode1 = fake_location_code(EventType, LocationCode), DeviceInfo = #{ % <<"location">> => LocationCode, <<"location">> => LocationCode1, @@ -267,7 +267,8 @@ serialize0([{K, V}|T], 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 FakeLocationCodes = application:get_env(iot, fake_location_codes, []), - proplists:get_value(EventCode, FakeLocationCodes, LocationCode). \ No newline at end of file + proplists:get_value(EventType, FakeLocationCodes, LocationCode). \ No newline at end of file diff --git a/config/sys-dev.config b/config/sys-dev.config index 2e8851f..be418d4 100644 --- a/config/sys-dev.config +++ b/config/sys-dev.config @@ -19,6 +19,19 @@ 15 => 300 }}, + {fake_location_codes, [ + %% 鼠类监测 + {11, <<"0508103010001050300001">>}, + %% 异物占道 + {13, <<"0512104030001050400003">>}, + %% 垃圾箱(桶) + {14, <<"0507106030001050600003">>}, + %% 操作区人员着装不规范 + {12, <<"0500000000001022700537">>}, + %% 动火离人 + {15, <<"0500000000001022700538">>} + ]}, + {api_url, "http://39.98.184.67:8800"}, {watchdog, [ diff --git a/config/sys-prod.config b/config/sys-prod.config index 0928ebf..d024674 100644 --- a/config/sys-prod.config +++ b/config/sys-prod.config @@ -20,11 +20,16 @@ }}, {fake_location_codes, [ - {<<"23103">>, <<"0508103010001050300001">>}, - {<<"20407">>, <<"0512104030001050400003">>}, - {<<"10404">>, <<"0507106030001050600003">>}, - {<<"22503">>, <<"0500000000001022700537">>}, - {<<"23104">>, <<"0500000000001022700538">>} + %% 鼠类监测 + {11, <<"0508103010001050300001">>}, + %% 异物占道 + {13, <<"0512104030001050400003">>}, + %% 垃圾箱(桶) + {14, <<"0507106030001050600003">>}, + %% 操作区人员着装不规范 + {12, <<"0500000000001022700537">>}, + %% 动火离人 + {15, <<"0500000000001022700538">>} ]}, {watchdog, [