mirror of
https://gitee.com/dgiiot/dgiot.git
synced 2024-12-02 20:28:40 +08:00
Channel parameter de duplication
This commit is contained in:
parent
062276c073
commit
9222d9c1d4
@ -158,7 +158,7 @@ do_request(get_actions_id, #{<<"id">> := RuleID}, _Context, _Req) ->
|
|||||||
|
|
||||||
do_request(get_resources, _Args, _Context, _Req) ->
|
do_request(get_resources, _Args, _Context, _Req) ->
|
||||||
{ok, #{data := Data} = Result} = emqx_rule_engine_api:list_resources(#{}, []),
|
{ok, #{data := Data} = Result} = emqx_rule_engine_api:list_resources(#{}, []),
|
||||||
{ok, Result#{data => Data ++ get_channel()}};
|
{ok, Result#{data => get_channel(Data)}};
|
||||||
|
|
||||||
%% OperationId:post_rule_resource
|
%% OperationId:post_rule_resource
|
||||||
do_request(post_resources, Params, _Context, _Req) ->
|
do_request(post_resources, Params, _Context, _Req) ->
|
||||||
@ -201,7 +201,8 @@ do_request(_OperationId, _Args, _Context, _Req) ->
|
|||||||
%% {error, Reason1}
|
%% {error, Reason1}
|
||||||
%% end.
|
%% end.
|
||||||
|
|
||||||
get_channel() ->
|
get_channel(Data) ->
|
||||||
|
?LOG(error, "~p", [Data]),
|
||||||
case dgiot_parse:query_object(<<"Channel">>, #{<<"keys">> => [<<"name">>]}) of
|
case dgiot_parse:query_object(<<"Channel">>, #{<<"keys">> => [<<"name">>]}) of
|
||||||
{ok, #{<<"results">> := Results}} when length(Results) > 0 ->
|
{ok, #{<<"results">> := Results}} when length(Results) > 0 ->
|
||||||
lists:foldl(fun(#{<<"objectId">> := ChannelId,<<"name">> := Name}, Acc) ->
|
lists:foldl(fun(#{<<"objectId">> := ChannelId,<<"name">> := Name}, Acc) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user