fix donghuoliren

This commit is contained in:
anlicheng 2024-12-13 20:20:28 +08:00
parent e02956eed4
commit 06e901df43

View File

@ -106,7 +106,7 @@ handle_cast({forward, LocationCode, DynamicLocationCode, EventType, Params},
iot_logger:write(LoggerPid, [<<"OK">>, list_to_binary(Url1), Body, RespBody]),
{noreply, State#state{succ_counter = SuccCounter + 1}};
{error, Reason} ->
NReason = iolist_to_binary(io_lib:format("~p", Reason)),
NReason = iolist_to_binary(io_lib:format("~p", [Reason])),
iot_logger:write(LoggerPid, [<<"ERROR">>, list_to_binary(Url1), Body, NReason]),
{noreply, State#state{fail_counter = FailCounter + 1}}
end.
@ -211,7 +211,21 @@ serialize0([{K, V}|T], Target) ->
is_boolean(V) andalso not V ->
<<"false">>;
is_list(V) ->
V0 = iolist_to_binary(lists:join(<<$,>>, V)),
Items = lists:map(fun(E) ->
if
is_integer(E) ->
integer_to_binary(E);
is_float(E) ->
float_to_binary(E);
is_binary(E) ->
<<$", E/binary, $">>;
is_boolean(E) andalso E ->
<<"true">>;
is_boolean(E) andalso not E ->
<<"false">>
end
end, V),
V0 = iolist_to_binary(lists:join(<<$,>>, Items)),
<<$[, V0/binary, $]>>
end,
Item = <<$", K/binary, $", $:, V1/binary>>,