fix: delete devcie failed

This commit is contained in:
jhonliu 2022-05-20 13:06:54 +08:00
parent 241091e5e1
commit df832a26de
2 changed files with 3 additions and 1 deletions

View File

@ -170,7 +170,7 @@ handle_message({sync_parse, _Pid, 'after', put, _Token, <<"Device">>, QueryData}
handle_message({sync_parse, _Pid, 'after', delete, _Token, <<"Device">>, ObjectId}, State) ->
%% io:format("~s ~p ~p ~p ~n", [?FILE, ?LINE, Pid, ObjectId]),
dgiot_device:delete('after', ObjectId),
dgiot_device_hook:delete('after', ObjectId),
{ok, State};
handle_message({sync_parse, Pid, 'after', get, Token, <<"Product">>, #{<<"results">> := _Results} = ResBody}, State) ->

View File

@ -34,6 +34,7 @@ put(_, _) ->
pass.
delete('after', DeviceId) ->
dgiot_device:delete(DeviceId),
case dgiot_parse:query_object(<<"Dict">>, #{<<"where">> => #{<<"key">> => DeviceId, <<"class">> => <<"Device">>}}) of
{ok, #{<<"results">> := Dicts}} ->
DictRequests =
@ -63,6 +64,7 @@ delete('after', DeviceId) ->
pass
end;
delete(_, _) ->
pass.