From 6a51ce86273b11fa3001d91d535fdc8ef0c45b33 Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Tue, 7 Jul 2026 23:40:05 +0800 Subject: [PATCH] fix deploy params --- apps/efka/src/iot/efka_iot_client.erl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/efka/src/iot/efka_iot_client.erl b/apps/efka/src/iot/efka_iot_client.erl index d12fbdf..f79808c 100644 --- a/apps/efka/src/iot/efka_iot_client.erl +++ b/apps/efka/src/iot/efka_iot_client.erl @@ -551,7 +551,7 @@ handle_container_request(Ref, Request, Socket) -> decode_container_command(#'Command.Container'{action = {list, #'Command.Container.ContainerList'{}}}) -> #{<<"action">> => <<"list">>}; decode_container_command(#'Command.Container'{action = {deploy, #'Command.Container.ContainerDeploy'{task_id = TaskId, params = Params}}}) -> - #{<<"action">> => <<"deploy">>, <<"task_id">> => TaskId, <<"params">> => decode_term_payload(Params)}; + #{<<"action">> => <<"deploy">>, <<"task_id">> => TaskId, <<"params">> => decode_json_payload(Params)}; decode_container_command(#'Command.Container'{action = {start, #'Command.Container.ContainerStart'{target = Target}}}) -> #{<<"action">> => <<"start">>, <<"target">> => decode_container_target(Target)}; decode_container_command(#'Command.Container'{action = {stop, #'Command.Container.ContainerStop'{target = Target, timeout_seconds = TimeoutSeconds}}}) -> @@ -571,14 +571,14 @@ decode_container_target(#'Command.Container.ContainerTarget'{name = Name, id = I decode_container_target(undefined) -> #{<<"name">> => <<>>, <<"id">> => <<>>}. --spec decode_term_payload(iodata()) -> term(). -decode_term_payload(Payload) -> +-spec decode_json_payload(iodata()) -> term(). +decode_json_payload(Payload) -> Bin = iolist_to_binary(Payload), - try binary_to_term(Bin, [safe]) of + try json:decode(Bin) of Term -> Term catch - error:_ -> + _:_ -> Bin end. @@ -728,4 +728,4 @@ to_bool(1) -> to_bool(false) -> false; to_bool(0) -> - false. \ No newline at end of file + false.