fix: tdengine get_appdata bug

This commit is contained in:
AvantLiu 2022-01-21 16:14:06 +08:00
parent 9d7853b29b
commit 435a2f1e30

View File

@ -228,10 +228,10 @@ get_appdata(Channel, ProductId, DeviceId, _Args) ->
_ ->
TableName = ?Table(DeviceId),
case dgiot_tdengine:get_appdata(Channel, TableName, #{<<"db">> => ProductId}) of
{ok, #{<<"results">> := Results}} ->
{ok, #{<<"results">> := Results}} when length(Results) > 0->
Chartdata = get_app(ProductId, Results, DeviceId),
{ok, #{<<"data">> => Chartdata}};
{error, _Reason} ->
_ ->
Chartdata = get_app(ProductId, [#{}], DeviceId),
{ok, #{<<"data">> => Chartdata}}
end