This commit is contained in:
anlicheng 2023-06-20 21:40:43 +08:00
parent 2d86155a88
commit 5c325f3d8a
2 changed files with 4 additions and 4 deletions

View File

@ -315,7 +315,7 @@ handle_event(cast, {handle, <<?METHOD_FEEDBACK_STEP:8, Info0/binary>>}, session,
Info = iot_cipher_aes:decrypt(AES, Info0),
case catch jiffy:decode(Info, [return_maps]) of
Data = #{<<"task_id">> := TaskId, <<"code">> := Code} ->
Result = scene_feedback:insert(#{
Result = scene_feedback_step:insert(#{
<<"task_id">> => TaskId,
<<"code">> => Code,
<<"created_at">> => iot_util:current_time()

View File

@ -77,7 +77,7 @@ stop() ->
ping() ->
Pid = whereis(?MODULE),
erlang:start_timer(0, Pid, ping_ticker).
erlang:start_timer(0, Pid, feedback_step_ticker).
%% @doc Spawns the server and registers the local name (unique)
-spec(start_link(UUID :: binary()) ->
@ -195,14 +195,14 @@ handle_info({publish, #{payload := Payload, qos := Qos, topic := FromTopic}},
%% t = 8
<<8:8, Command/binary>> ->
case jiffy:decode(Command, [return_maps]) of
#{<<"auth">> := true, <<"reply">> := #{<<"topic">> := Topic, <<"assoc">> := Assoc}} ->
#{<<"auth">> := true, <<"reply">> := #{<<"topic">> := ReplyTopic, <<"assoc">> := Assoc}} ->
Msg = jiffy:encode(#{
<<"code">> => 1,
<<"message">> => "",
<<"assoc">> => Assoc
}, [force_utf8]),
{ok, Ref} = iot_mqtt_publisher:publish(Topic, Msg, 1),
{ok, Ref} = iot_mqtt_publisher:publish(ReplyTopic, Msg, 1),
receive
{ok, Ref, PacketId} ->
lager:debug("[host_mocker] send reply success, packet_id: ~p", [PacketId]);