This commit is contained in:
anlicheng 2023-06-15 11:44:58 +08:00
parent 1eb246c43c
commit d2c57bc2bf
2 changed files with 5 additions and 4 deletions

View File

@ -315,7 +315,8 @@ handle_message(#{<<"method">> := <<"inform">>, <<"params">> := Info0}, State = #
Info = iot_cipher_aes:decrypt(AES, base64:decode(Info0)),
case catch jiffy:decode(Info, [return_maps]) of
#{<<"at">> := At, <<"services">> := ServiceInforms} ->
lists:foreach(fun(#{<<"scene_id">> := SceneId, <<"name">> := Name, <<"version">> := Version, <<"version_copy">> := VersionCopy, <<"status">> := Status}) ->
lists:foreach(fun(Item = #{<<"name">> := Name, <<"version">> := Version, <<"version_copy">> := VersionCopy, <<"status">> := Status}) ->
SceneId = maps:get(<<"scene_id">>, Item, 0),
micro_inform_log:insert(#{
<<"host_id">> => HostId,
<<"scene_id">> => SceneId,
@ -330,7 +331,7 @@ handle_message(#{<<"method">> := <<"inform">>, <<"params">> := Info0}, State = #
ok
end, ServiceInforms);
Error ->
lager:warning("[iot_host] inform error: ~p", [Error])
lager:warning("[iot_host] inform get error: ~p", [Error])
end,
State;

View File

@ -308,11 +308,11 @@ handle_info({timeout, _, inform_ticker}, State = #state{aes = Aes, topic = Topic
handle_info({timeout, _, feedback_ticker}, State = #state{aes = Aes, topic = Topic}) ->
Info = jiffy:encode(#{
<<"task_id">> => 1,
<<"task_type">> => 2,
<<"type">> => 2,
<<"code">> => 200,
<<"reason">> => <<"ok">>,
<<"error">> => <<"">>,
<<"created_at">> => iot_util:current_time()
<<"time">> => iot_util:current_time()
}, [force_utf8]),
Msg = jiffy:encode(#{