Skip to content

Commit

Permalink
feat:zip changed to tar
Browse files Browse the repository at this point in the history
  • Loading branch information
AvantLiu committed Dec 28, 2021
1 parent 2f6196d commit 9393b6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 23 deletions.
14 changes: 0 additions & 14 deletions apps/dgiot_mqtt/src/dgiot_mqtt_channel.erl
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ init(?TYPE, ChannelId, #{
%% 创建断开连接规则
DisRawsql = <<"SELECT clientid, disconnected_at FROM \"$events/client_disconnected\" WHERE username = '", ProductId/binary, "'">>,
create_rules(<<"rule:disconnected_", ProductId/binary>>, ChannelId, <<"断开连接规则"/utf8>>, DisRawsql, <<"/${productid}/#">>),
%% 创建上传数据规则
RepRawsql = <<"SELECT payload.msg as msg,clientid,'", ProductId/binary, "' as productid FROM \"/thing/", ProductId/binary, "/#\" WHERE username = '", ProductId/binary, "'">>,
create_rules(<<"rule:thingreport_", ProductId/binary>>, ChannelId, <<"物模型上报规则"/utf8>>, RepRawsql, <<"/thing/${productid}/#">>),
%% 创建上传数据规则
MetaRawsql = <<"SELECT payload.msg as msg,clientid,'", ProductId/binary, "' as productid FROM \"/", ProductId/binary, "/#\" WHERE username = '", ProductId/binary, "'">>,
create_rules(<<"rule:metadata_", ProductId/binary>>, ChannelId, <<"派生物模型上报规则"/utf8>>, MetaRawsql, <<"/${productid}/#">>);
Expand Down Expand Up @@ -147,17 +144,6 @@ handle_message({rule, #{clientid := _DeviceId, username := ProductId, payload :=
io:format("~s ~p error: ~p~n", [?FILE, ?LINE, _Other1]),
pass
end;
[<<>>, <<"thing">>, ProductId1, DtuAddr1, <<"up">>] ->
%% create_device(ProductId, DtuAddr, Peerhost),
case jsx:decode(Payload, [{labels, binary}, return_maps]) of
#{<<"id">> := Devaddr, <<"name">> := Name, <<"messageid">> := Messageid, <<"events">> := #{<<"id">> := <<"login">>, <<"value">> := #{<<"ip">> := Ip}}} = Data ->
create_device(ProductId, Devaddr, Name, Ip),
NotificationTopic = <<"/thing/", ProductId1/binary, "/", DtuAddr1/binary, "/down">>,
dgiot_mqtt:publish(Devaddr, NotificationTopic, jsx:encode(Data#{<<"replyid">> => Messageid, <<"events">> => #{<<"id">> => <<"replylogin">>, <<"value">> => <<"success">>}}));
_Other ->
io:format("~s ~p error: ~p~n", [?FILE, ?LINE, _Other]),
pass
end;
[<<>>, ProductId, DtuAddr, <<"report">>, <<"opc">>, <<"properties">>] ->
create_device(ProductId, DtuAddr, <<"OPC_", DtuAddr/binary>>, Peerhost),
case jsx:decode(Payload, [{labels, binary}, return_maps]) of
Expand Down
18 changes: 9 additions & 9 deletions dgiot_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -681,33 +681,33 @@ function install_go_fastdfs() {
mkdir -p ${install_dir}/go_fastdfs/files/
fi

if [ ! -f ${script_dir}/dgiot_file.zip ]; then
wget ${fileserver}/dgiot_file.zip -O ${script_dir}/dgiot_file.zip &> /dev/null
if [ ! -f ${script_dir}/dgiot_file.tar.gz ]; then
wget ${fileserver}/dgiot_file.tar.gz -O ${script_dir}/dgiot_file.tar.gz &> /dev/null
fi
cd ${script_dir}/
if [ -d ${script_dir}/dgiot_file/ ]; then
rm ${script_dir}/dgiot_file/ -rf
fi
unzip dgiot_file.zip &> /dev/null
tar xf dgiot_file.tar.gz &> /dev/null
mv ${script_dir}/dgiot_file ${install_dir}/go_fastdfs/files/

if [ ! -f ${script_dir}/dgiot_swagger.zip ]; then
wget ${fileserver}/dgiot_swagger.zip -O ${script_dir}/dgiot_swagger.zip &> /dev/null
if [ ! -f ${script_dir}/dgiot_swagger.tar.gz ]; then
wget ${fileserver}/dgiot_swagger.tar.gz -O ${script_dir}/dgiot_swagger.tar.gz &> /dev/null
fi
if [ -d ${script_dir}/dgiot_swagger/ ]; then
rm ${script_dir}/dgiot_swagger/ -rf
fi
unzip dgiot_swagger.zip &> /dev/null
tar xf dgiot_swagger.tar.gz &> /dev/null
mv ${script_dir}/dgiot_swagger ${install_dir}/go_fastdfs/files/

if [ ! -f ${script_dir}/dgiot_dashboard.zip ]; then
wget ${fileserver}/dgiot_dashboard.zip -O ${script_dir}/dgiot_dashboard.zip &> /dev/null
if [ ! -f ${script_dir}/dgiot_dashboard.tar.gz ]; then
wget ${fileserver}/dgiot_dashboard.tar.gz -O ${script_dir}/dgiot_dashboard.tar.gz &> /dev/null
fi
cd ${script_dir}/
if [ -d ${script_dir}/dgiot_dashboard/ ]; then
rm ${script_dir}/dgiot_dashboard/ -rf
fi
unzip dgiot_dashboard.zip &> /dev/null
tar xf dgiot_dashboard.tar.gz &> /dev/null

mv ${script_dir}/dgiot_dashboard ${install_dir}/go_fastdfs/files/

Expand Down

0 comments on commit 9393b6e

Please sign in to comment.