增加测试代码
This commit is contained in:
parent
dcd23dd6da
commit
ce7ad8a22c
@ -185,9 +185,19 @@ format_events(LocationCode, DynamicLocationCode, EventType, #{<<"event_code">> :
|
|||||||
end, Attachments0),
|
end, Attachments0),
|
||||||
|
|
||||||
% <<"occurrenceTime">> => <<"2023-06-10 12:00:00">>,
|
% <<"occurrenceTime">> => <<"2023-06-10 12:00:00">>,
|
||||||
|
% TODO delete
|
||||||
|
FakeLocationCodes = application:get_env(iot, fake_location_codes, []),
|
||||||
|
LocationCode1 = case length(FakeLocationCodes) > 0 of
|
||||||
|
true ->
|
||||||
|
Len = length(FakeLocationCodes),
|
||||||
|
RandomIndex = rand:uniform(Len),
|
||||||
|
lists:nth(RandomIndex, FakeLocationCodes);
|
||||||
|
false ->
|
||||||
|
LocationCode
|
||||||
|
end,
|
||||||
DeviceInfo = #{
|
DeviceInfo = #{
|
||||||
<<"location">> => LocationCode,
|
% <<"location">> => LocationCode,
|
||||||
|
<<"location">> => LocationCode1,
|
||||||
<<"category">> => EventCode,
|
<<"category">> => EventCode,
|
||||||
<<"description">> => Description,
|
<<"description">> => Description,
|
||||||
<<"occurrenceTime">> => Datetime,
|
<<"occurrenceTime">> => Datetime,
|
||||||
|
|||||||
@ -169,7 +169,7 @@ handle_info({timeout, _, warn_ticker}, State = #state{warn_buf = WarnBuf, url =
|
|||||||
case length(WarnBuf) > 0 of
|
case length(WarnBuf) > 0 of
|
||||||
true ->
|
true ->
|
||||||
Warn0 = hd(WarnBuf),
|
Warn0 = hd(WarnBuf),
|
||||||
Warn = iolist_to_binary([Warn0, <<"(累计: ">>, length(WarnBuf), <<")">>]),
|
Warn = iolist_to_binary([Warn0, <<"(累计: ">>, integer_to_binary(length(WarnBuf)), <<")">>]),
|
||||||
Body = format_warn(Warn, Users, PriKey),
|
Body = format_warn(Warn, Users, PriKey),
|
||||||
case catch do_post(Url, Body) of
|
case catch do_post(Url, Body) of
|
||||||
{ok, Resp} ->
|
{ok, Resp} ->
|
||||||
|
|||||||
@ -14,6 +14,10 @@
|
|||||||
%% 数据的最大缓存量
|
%% 数据的最大缓存量
|
||||||
{device_cache_size, 200},
|
{device_cache_size, 200},
|
||||||
|
|
||||||
|
{fake_location_codes, [
|
||||||
|
"0517105041011073100004"
|
||||||
|
]},
|
||||||
|
|
||||||
{watchdog, [
|
{watchdog, [
|
||||||
{pri_key, "jinzhi_watchdog_pri.key"},
|
{pri_key, "jinzhi_watchdog_pri.key"},
|
||||||
{url, "http://172.30.37.242:8080/hqtaskcenterapp/sys/taskCenter/taskReceive/sendNotice.do"},
|
{url, "http://172.30.37.242:8080/hqtaskcenterapp/sys/taskCenter/taskReceive/sendNotice.do"},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user