fix
This commit is contained in:
parent
2d86155a88
commit
5c325f3d8a
@ -315,7 +315,7 @@ handle_event(cast, {handle, <<?METHOD_FEEDBACK_STEP:8, Info0/binary>>}, session,
|
|||||||
Info = iot_cipher_aes:decrypt(AES, Info0),
|
Info = iot_cipher_aes:decrypt(AES, Info0),
|
||||||
case catch jiffy:decode(Info, [return_maps]) of
|
case catch jiffy:decode(Info, [return_maps]) of
|
||||||
Data = #{<<"task_id">> := TaskId, <<"code">> := Code} ->
|
Data = #{<<"task_id">> := TaskId, <<"code">> := Code} ->
|
||||||
Result = scene_feedback:insert(#{
|
Result = scene_feedback_step:insert(#{
|
||||||
<<"task_id">> => TaskId,
|
<<"task_id">> => TaskId,
|
||||||
<<"code">> => Code,
|
<<"code">> => Code,
|
||||||
<<"created_at">> => iot_util:current_time()
|
<<"created_at">> => iot_util:current_time()
|
||||||
|
|||||||
@ -77,7 +77,7 @@ stop() ->
|
|||||||
|
|
||||||
ping() ->
|
ping() ->
|
||||||
Pid = whereis(?MODULE),
|
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)
|
%% @doc Spawns the server and registers the local name (unique)
|
||||||
-spec(start_link(UUID :: binary()) ->
|
-spec(start_link(UUID :: binary()) ->
|
||||||
@ -195,14 +195,14 @@ handle_info({publish, #{payload := Payload, qos := Qos, topic := FromTopic}},
|
|||||||
%% t = 8采用明文消息
|
%% t = 8采用明文消息
|
||||||
<<8:8, Command/binary>> ->
|
<<8:8, Command/binary>> ->
|
||||||
case jiffy:decode(Command, [return_maps]) of
|
case jiffy:decode(Command, [return_maps]) of
|
||||||
#{<<"auth">> := true, <<"reply">> := #{<<"topic">> := Topic, <<"assoc">> := Assoc}} ->
|
#{<<"auth">> := true, <<"reply">> := #{<<"topic">> := ReplyTopic, <<"assoc">> := Assoc}} ->
|
||||||
Msg = jiffy:encode(#{
|
Msg = jiffy:encode(#{
|
||||||
<<"code">> => 1,
|
<<"code">> => 1,
|
||||||
<<"message">> => "",
|
<<"message">> => "",
|
||||||
<<"assoc">> => Assoc
|
<<"assoc">> => Assoc
|
||||||
}, [force_utf8]),
|
}, [force_utf8]),
|
||||||
|
|
||||||
{ok, Ref} = iot_mqtt_publisher:publish(Topic, Msg, 1),
|
{ok, Ref} = iot_mqtt_publisher:publish(ReplyTopic, Msg, 1),
|
||||||
receive
|
receive
|
||||||
{ok, Ref, PacketId} ->
|
{ok, Ref, PacketId} ->
|
||||||
lager:debug("[host_mocker] send reply success, packet_id: ~p", [PacketId]);
|
lager:debug("[host_mocker] send reply success, packet_id: ~p", [PacketId]);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user