From 315c0a6c2776c51ddaa9978746485033b7940841 Mon Sep 17 00:00:00 2001 From: PandaX-Go Date: Thu, 29 Aug 2024 21:58:27 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BC=98=E5=8C=96]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.yml | 14 +++++++------- pkg/rule_engine/nodes/action_create_alarm_node.go | 4 ++-- .../nodes/action_rpc_request_from_device_node.go | 4 ++-- .../nodes/action_rpc_request_to_device_node.go | 4 ++-- pkg/rule_engine/nodes/external_ding_node.go | 2 +- pkg/transport/http_server.go | 1 - 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/config.yml b/config.yml index 14c15fd..f52009b 100644 --- a/config.yml +++ b/config.yml @@ -5,11 +5,11 @@ app: server: # debug release test model: release - port: 7799 + port: 7788 # iothub服务端口 使用的rpc端口 9000 9001 可能与minio端口冲突 - grpc-port: 7701 - http-port: 7702 - tcp-port: 7703 + grpc-port: 9001 + http-port: 9002 + tcp-port: 9003 cors: true # 接口限流 rate: @@ -34,7 +34,7 @@ queue: ch-num: 3000 #并发执行数,同时处理多少条数据 redis: - host: 192.168.10.242 + host: 127.0.0.1 password: 123456 port: 6379 @@ -42,7 +42,7 @@ mysql: host: 127.0.0.1:3306 username: root password: 123456 - db-name: pandax_iot + db-name: pandax config: charset=utf8&loc=Local&parseTime=true postgresql: @@ -65,7 +65,7 @@ oss: taos: username: "root" password: "taosdata" - host: "192.168.10.242:6041" + host: "127.0.0.1:6041" database: "iot" config: "" diff --git a/pkg/rule_engine/nodes/action_create_alarm_node.go b/pkg/rule_engine/nodes/action_create_alarm_node.go index 7e39754..93d8f5b 100644 --- a/pkg/rule_engine/nodes/action_create_alarm_node.go +++ b/pkg/rule_engine/nodes/action_create_alarm_node.go @@ -3,9 +3,9 @@ package nodes import ( "encoding/json" "errors" + "github.com/PandaXGO/PandaKit/utils" "pandax/apps/device/entity" "pandax/apps/device/services" - "pandax/kit/utils" "pandax/pkg/global" "pandax/pkg/rule_engine/message" "time" @@ -55,7 +55,7 @@ func (n *createAlarmNode) Handle(msg *message.Message) error { } } else { alarm = &entity.DeviceAlarm{} - alarm.Id = utils.GenerateID() + alarm.Id = utils.GenerateID("") alarm.DeviceId = msg.Metadata.GetStringValue("deviceId") alarm.ProductId = msg.Metadata.GetStringValue("productId") alarm.Name = msg.Metadata.GetStringValue("deviceName") diff --git a/pkg/rule_engine/nodes/action_rpc_request_from_device_node.go b/pkg/rule_engine/nodes/action_rpc_request_from_device_node.go index 85ffec2..6c9f758 100644 --- a/pkg/rule_engine/nodes/action_rpc_request_from_device_node.go +++ b/pkg/rule_engine/nodes/action_rpc_request_from_device_node.go @@ -2,11 +2,11 @@ package nodes import ( "errors" + "github.com/PandaXGO/PandaKit/utils" "pandax/apps/device/services" "pandax/iothub/client/mqttclient" "pandax/iothub/client/tcpclient" "pandax/iothub/client/udpclient" - "pandax/kit/utils" devicerpc "pandax/pkg/device_rpc" "pandax/pkg/global" "pandax/pkg/rule_engine/message" @@ -80,7 +80,7 @@ func (n *rpcRequestFromDeviceNode) Handle(msg *message.Message) error { rpc := &mqttclient.RpcRequest{} if n.RequestId == "" { if msg.Metadata.GetStringValue("requestId") == "" { - rpc.RequestId = utils.GenerateID() + rpc.RequestId = utils.GenerateID("") } else { rpc.RequestId = msg.Metadata.GetStringValue("requestId") } diff --git a/pkg/rule_engine/nodes/action_rpc_request_to_device_node.go b/pkg/rule_engine/nodes/action_rpc_request_to_device_node.go index 9fb197a..f20879e 100644 --- a/pkg/rule_engine/nodes/action_rpc_request_to_device_node.go +++ b/pkg/rule_engine/nodes/action_rpc_request_to_device_node.go @@ -3,12 +3,12 @@ package nodes import ( "encoding/json" "errors" + "github.com/PandaXGO/PandaKit/utils" "pandax/apps/device/entity" "pandax/apps/device/services" "pandax/iothub/client/mqttclient" "pandax/iothub/client/tcpclient" "pandax/iothub/client/udpclient" - "pandax/kit/utils" "pandax/pkg/global" "pandax/pkg/global/model" "pandax/pkg/rule_engine/message" @@ -60,7 +60,7 @@ func (n *rpcRequestToDeviceNode) Handle(msg *message.Message) error { // 构建指令记录 var data entity.DeviceCmdLog - data.Id = utils.GenerateID() + data.Id = utils.GenerateID("") data.DeviceId = deviceId data.CmdName = datas.Method data.CmdContent = kgo.KConv.ToStr(datas.Params) diff --git a/pkg/rule_engine/nodes/external_ding_node.go b/pkg/rule_engine/nodes/external_ding_node.go index 137f227..1db7ce7 100644 --- a/pkg/rule_engine/nodes/external_ding_node.go +++ b/pkg/rule_engine/nodes/external_ding_node.go @@ -6,8 +6,8 @@ import ( "encoding/base64" "encoding/json" "fmt" + "github.com/PandaXGO/PandaKit/httpclient" "net/url" - "pandax/kit/httpclient" "pandax/pkg/rule_engine/message" "time" ) diff --git a/pkg/transport/http_server.go b/pkg/transport/http_server.go index 97d18ec..55db184 100644 --- a/pkg/transport/http_server.go +++ b/pkg/transport/http_server.go @@ -35,7 +35,6 @@ func (s *HttpServer) Type() Type { } func (s *HttpServer) Start(ctx context.Context) error { - global.Log.Infof("HTTP Server listen: %s", s.Addr) go func() { if global.Conf.Server.Tls.Enable { global.Log.Infof("HTTPS Server listen: %s", s.Addr)