feedback step
This commit is contained in:
parent
f0f7873041
commit
3b9be77e43
17
apps/iot/src/database/scene_feedback_step.erl
Normal file
17
apps/iot/src/database/scene_feedback_step.erl
Normal file
@ -0,0 +1,17 @@
|
||||
%%%-------------------------------------------------------------------
|
||||
%%% @author aresei
|
||||
%%% @copyright (C) 2023, <COMPANY>
|
||||
%%% @doc
|
||||
%%%
|
||||
%%% @end
|
||||
%%% Created : 16. 5月 2023 12:48
|
||||
%%%-------------------------------------------------------------------
|
||||
-module(scene_feedback_step).
|
||||
-author("aresei").
|
||||
-include("iot.hrl").
|
||||
|
||||
%% API
|
||||
-export([insert/1]).
|
||||
|
||||
insert(Fields) when is_map(Fields) ->
|
||||
mysql_client:insert(<<"scene_feedback_step">>, Fields, true).
|
||||
@ -314,8 +314,13 @@ handle_event(cast, {handle, <<?METHOD_INFORM:8, Info0/binary>>}, session, State
|
||||
handle_event(cast, {handle, <<?METHOD_FEEDBACK_STEP:8, Info0/binary>>}, session, State = #state{aes = AES}) ->
|
||||
Info = iot_cipher_aes:decrypt(AES, Info0),
|
||||
case catch jiffy:decode(Info, [return_maps]) of
|
||||
Data when is_map(Data) ->
|
||||
lager:warning("[iot_host] feedback_step info: ~p", [Data]);
|
||||
Data = #{<<"task_id">> := TaskId, <<"code">> := Code} ->
|
||||
Result = scene_feedback:insert(#{
|
||||
<<"task_id">> => TaskId,
|
||||
<<"code">> => Code,
|
||||
<<"created_at">> => iot_util:current_time()
|
||||
}),
|
||||
lager:warning("[iot_host] feedback_step info: ~p, insert result: ~p", [Data, Result]);
|
||||
Other ->
|
||||
lager:warning("[iot_host] feedback_step error: ~p", [Other])
|
||||
end,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user