mirror of
https://gitee.com/dgiiot/dgiot.git
synced 2024-11-30 03:07:40 +08:00
Update nginx version
This commit is contained in:
parent
ffd647eda9
commit
68e53a853e
@ -208,6 +208,7 @@ save_rule_to_dict(RuleID, Params) ->
|
||||
emqx_rule_engine_api:update_rule(#{id => RuleID}, maps:to_list(Nedata)),
|
||||
Nedata
|
||||
end,
|
||||
%% todo class title key type 多个channel 存多条dict ,title都用RuleID
|
||||
Dict = #{
|
||||
<<"key">> => RuleID,
|
||||
<<"type">> => <<"ruleengine">>,
|
||||
|
@ -65,7 +65,7 @@ handle_info({tcp, Buff}, #tcp{socket = Socket, state = #state{id = ChannelId, de
|
||||
{DevId1, Devaddr1}
|
||||
end,
|
||||
Topic = <<"profile/", ProductId/binary, "/", Devaddr/binary>>,
|
||||
dgiot_bridge:send_log(ChannelId, ProductId, Devaddr, "DTU revice from ~p", [dgiot_utils:binary_to_hex(Buff)]),
|
||||
dgiot_bridge:send_log(ChannelId, ProductId, Devaddr, "DTU login [~p]", [dgiot_utils:binary_to_hex(Buff)]),
|
||||
dgiot_mqtt:subscribe(Topic),
|
||||
DtuId = dgiot_parse:get_deviceid(ProductId, DtuAddr),
|
||||
{noreply, TCPState#tcp{buff = <<>>, register = true, clientid = DtuId, state = State#state{devaddr = Devaddr, deviceId = DevId}}};
|
||||
@ -74,7 +74,7 @@ handle_info({tcp, Buff}, #tcp{socket = Socket, state = #state{id = ChannelId, de
|
||||
{match, [Head]} when length(List1) == Len ->
|
||||
create_device(DeviceId, ProductId, Buff, DTUIP, Dtutype),
|
||||
Topic = <<"profile/", ProductId/binary, "/", Buff/binary>>,
|
||||
dgiot_bridge:send_log(ChannelId, ProductId, Buff, "DTU revice from ~p", [dgiot_utils:binary_to_hex(Buff)]),
|
||||
dgiot_bridge:send_log(ChannelId, ProductId, Buff, "DTU login [~p]", [dgiot_utils:binary_to_hex(Buff)]),
|
||||
dgiot_mqtt:subscribe(Topic),
|
||||
DtuId = dgiot_parse:get_deviceid(ProductId, DtuAddr),
|
||||
{noreply, TCPState#tcp{buff = <<>>, register = true, clientid = DtuId, state = State#state{devaddr = Buff}}};
|
||||
@ -85,7 +85,7 @@ handle_info({tcp, Buff}, #tcp{socket = Socket, state = #state{id = ChannelId, de
|
||||
end;
|
||||
|
||||
handle_info({tcp, Buff}, #tcp{state = #state{id = ChannelId, devaddr = DtuAddr, env = #{product := ProductId, pn := Pn, di := Di}, product = DtuProductId} = State} = TCPState) ->
|
||||
dgiot_bridge:send_log(ChannelId, ProductId, DtuAddr, "DtuAddr ~p revice from ~p", [DtuAddr, dgiot_utils:binary_to_hex(Buff)]),
|
||||
dgiot_bridge:send_log(ChannelId, ProductId, DtuAddr, "[DtuAddr:~p] returns [~p] to Channel", [DtuAddr, dgiot_utils:binary_to_hex(Buff)]),
|
||||
<<H:8, L:8>> = dgiot_utils:hex_to_binary(modbus_rtu:is16(Di)),
|
||||
<<Sh:8, Sl:8>> = dgiot_utils:hex_to_binary(modbus_rtu:is16(Pn)),
|
||||
case modbus_rtu:parse_frame(Buff, #{}, #{
|
||||
@ -97,7 +97,7 @@ handle_info({tcp, Buff}, #tcp{state = #state{id = ChannelId, devaddr = DtuAddr,
|
||||
{_, Things} ->
|
||||
%% ?LOG(info, "Things ~p", [Things]),
|
||||
NewTopic = <<"thing/", DtuProductId/binary, "/", DtuAddr/binary, "/post">>,
|
||||
dgiot_bridge:send_log(ChannelId, ProductId, DtuAddr, "DtuAddr ~p end to_task: ~p: ~p ~n", [DtuAddr, NewTopic, jsx:encode(Things)]),
|
||||
dgiot_bridge:send_log(ChannelId, ProductId, DtuAddr, "Channel sends [~p] to [task:~p]", [DtuAddr, NewTopic, jsx:encode(Things)]),
|
||||
DeviceId = dgiot_parse:get_deviceid(ProductId, DtuAddr),
|
||||
dgiot_mqtt:publish(DeviceId, NewTopic, jsx:encode(Things));
|
||||
Other ->
|
||||
@ -125,7 +125,6 @@ handle_info({deliver, _, Msg}, #tcp{state = #state{id = ChannelId} = State} = TC
|
||||
end,
|
||||
{noreply, TCPState};
|
||||
[<<"thing">>, _ProductId, DevAddr] ->
|
||||
|
||||
case jsx:decode(Payload, [{labels, binary}, return_maps]) of
|
||||
[#{<<"thingdata">> := ThingData} | _] ->
|
||||
case ThingData of
|
||||
@ -143,7 +142,7 @@ handle_info({deliver, _, Msg}, #tcp{state = #state{id = ChannelId} = State} = TC
|
||||
<<"di">> => Di}),
|
||||
%% ?LOG(error, "Datas ~p", [Datas]),
|
||||
lists:map(fun(X) ->
|
||||
dgiot_bridge:send_log(ChannelId, ProductId, DevAddr, " to_device: ~p [~p] ", [DevAddr, dgiot_utils:binary_to_hex(X)]),
|
||||
dgiot_bridge:send_log(ChannelId, ProductId, DevAddr, "Channel sends [~p] to [DtuAddr:~p]", [DevAddr, dgiot_utils:binary_to_hex(X)]),
|
||||
dgiot_tcp_server:send(TCPState, X),
|
||||
timer:sleep(1000)
|
||||
end, Datas),
|
||||
@ -162,7 +161,7 @@ handle_info({deliver, _, Msg}, #tcp{state = #state{id = ChannelId} = State} = TC
|
||||
<<"di">> => Di}),
|
||||
%% ?LOG(error, "Datas ~p", [Datas]),
|
||||
lists:map(fun(X) ->
|
||||
dgiot_bridge:send_log(ChannelId, ProductId, DevAddr, "to_device: ~p [~p] ", [DevAddr, dgiot_utils:binary_to_hex(X)]),
|
||||
dgiot_bridge:send_log(ChannelId, ProductId, DevAddr, "Channel sends [~p] to [DtuAddr:~p]", [DevAddr, dgiot_utils:binary_to_hex(X)]),
|
||||
dgiot_tcp_server:send(TCPState, X),
|
||||
timer:sleep(1000)
|
||||
end, Datas),
|
||||
@ -186,7 +185,7 @@ handle_info({deliver, _, Msg}, #tcp{state = #state{id = ChannelId} = State} = TC
|
||||
#{<<"_dgiotprotocol">> := <<"modbus">>} ->
|
||||
Payloads = modbus_rtu:set_params(maps:without([<<"_dgiotprotocol">>], Payload), ProductId, DevAddr),
|
||||
lists:map(fun(X) ->
|
||||
dgiot_bridge:send_log(ChannelId, ProductId, DevAddr, "to_device: ~p [~p] ", [DevAddr, dgiot_utils:binary_to_hex(X)]),
|
||||
dgiot_bridge:send_log(ChannelId, ProductId, DevAddr, "Channel sends [~p] to [DtuAddr:~p]", [DevAddr, dgiot_utils:binary_to_hex(X)]),
|
||||
dgiot_tcp_server:send(TCPState, X)
|
||||
end, Payloads);
|
||||
_ ->
|
||||
|
@ -944,7 +944,7 @@ function install_nginx() {
|
||||
rpm -e nginx
|
||||
fi
|
||||
${csudo} rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm --force &> /dev/null
|
||||
${csudo} yum install -y nginx &> /dev/null
|
||||
${csudo} yum install -y nginx-1.20.1 &> /dev/null
|
||||
if [ ! -f ${script_dir}/nginx.conf ]; then
|
||||
wget $fileserver/nginx.conf -O ${script_dir}/nginx.conf &> /dev/null
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user