fix
This commit is contained in:
parent
1eb246c43c
commit
d2c57bc2bf
@ -315,7 +315,8 @@ handle_message(#{<<"method">> := <<"inform">>, <<"params">> := Info0}, State = #
|
|||||||
Info = iot_cipher_aes:decrypt(AES, base64:decode(Info0)),
|
Info = iot_cipher_aes:decrypt(AES, base64:decode(Info0)),
|
||||||
case catch jiffy:decode(Info, [return_maps]) of
|
case catch jiffy:decode(Info, [return_maps]) of
|
||||||
#{<<"at">> := At, <<"services">> := ServiceInforms} ->
|
#{<<"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(#{
|
micro_inform_log:insert(#{
|
||||||
<<"host_id">> => HostId,
|
<<"host_id">> => HostId,
|
||||||
<<"scene_id">> => SceneId,
|
<<"scene_id">> => SceneId,
|
||||||
@ -330,7 +331,7 @@ handle_message(#{<<"method">> := <<"inform">>, <<"params">> := Info0}, State = #
|
|||||||
ok
|
ok
|
||||||
end, ServiceInforms);
|
end, ServiceInforms);
|
||||||
Error ->
|
Error ->
|
||||||
lager:warning("[iot_host] inform error: ~p", [Error])
|
lager:warning("[iot_host] inform get error: ~p", [Error])
|
||||||
end,
|
end,
|
||||||
State;
|
State;
|
||||||
|
|
||||||
|
|||||||
@ -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}) ->
|
handle_info({timeout, _, feedback_ticker}, State = #state{aes = Aes, topic = Topic}) ->
|
||||||
Info = jiffy:encode(#{
|
Info = jiffy:encode(#{
|
||||||
<<"task_id">> => 1,
|
<<"task_id">> => 1,
|
||||||
<<"task_type">> => 2,
|
<<"type">> => 2,
|
||||||
<<"code">> => 200,
|
<<"code">> => 200,
|
||||||
<<"reason">> => <<"ok">>,
|
<<"reason">> => <<"ok">>,
|
||||||
<<"error">> => <<"">>,
|
<<"error">> => <<"">>,
|
||||||
<<"created_at">> => iot_util:current_time()
|
<<"time">> => iot_util:current_time()
|
||||||
}, [force_utf8]),
|
}, [force_utf8]),
|
||||||
|
|
||||||
Msg = jiffy:encode(#{
|
Msg = jiffy:encode(#{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user