From 4a8c674ba592ed8a9eaefca632e4ce239ddfc1b0 Mon Sep 17 00:00:00 2001 From: "U-JOHNLIU\\jonhl" Date: Thu, 24 Aug 2023 21:29:43 +0800 Subject: [PATCH] feat: add device count --- apps/dgiot_device/src/dgiot_device_channel.erl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/dgiot_device/src/dgiot_device_channel.erl b/apps/dgiot_device/src/dgiot_device_channel.erl index cda2aacb..f754a322 100644 --- a/apps/dgiot_device/src/dgiot_device_channel.erl +++ b/apps/dgiot_device/src/dgiot_device_channel.erl @@ -212,9 +212,14 @@ handle_message({sync_parse, Pid, 'after', get, Token, <<"Product">>, #{<<"result dgiot_parse_hook:publish(Pid, NewResBody), {ok, State}; -handle_message({sync_parse, Pid, 'after', get, _Token, <<"Product">>, #{<<"objectId">> := _ObjectId} = ResBody}, State) -> +handle_message({sync_parse, Pid, 'after', get, Token, <<"Product">>, #{<<"objectId">> := _ObjectId} = ResBody}, State) -> %% io:format("~s ~p ~p ~p ~n", [?FILE, ?LINE, Pid, ObjectId]), - dgiot_parse_hook:publish(Pid, ResBody), + Key = dgiot_device_static:get_count(Token), +%% io:format("~s ~p ~p ~n", [?FILE, ?LINE, Key]), + timer:sleep(100), + NewResBody = dgiot_device_static:stats(ResBody, Key), +%% io:format("~s ~p ~p ~p ~n", [?FILE, ?LINE, Pid,NewResBody]), + dgiot_parse_hook:publish(Pid, NewResBody), {ok, State}; handle_message({sync_parse, _Pid, 'after', post, _Token, <<"Product">>, QueryData}, State) -> @@ -292,4 +297,3 @@ handle_message(Message, State) -> stop(ChannelType, ChannelId, _State) -> ?LOG(warning, "Channel[~p,~p] stop", [ChannelType, ChannelId]), ok. -