mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 02:48:34 +08:00
[优化]
This commit is contained in:
14
config.yml
14
config.yml
@@ -5,11 +5,11 @@ app:
|
|||||||
server:
|
server:
|
||||||
# debug release test
|
# debug release test
|
||||||
model: release
|
model: release
|
||||||
port: 7799
|
port: 7788
|
||||||
# iothub服务端口 使用的rpc端口 9000 9001 可能与minio端口冲突
|
# iothub服务端口 使用的rpc端口 9000 9001 可能与minio端口冲突
|
||||||
grpc-port: 7701
|
grpc-port: 9001
|
||||||
http-port: 7702
|
http-port: 9002
|
||||||
tcp-port: 7703
|
tcp-port: 9003
|
||||||
cors: true
|
cors: true
|
||||||
# 接口限流
|
# 接口限流
|
||||||
rate:
|
rate:
|
||||||
@@ -34,7 +34,7 @@ queue:
|
|||||||
ch-num: 3000 #并发执行数,同时处理多少条数据
|
ch-num: 3000 #并发执行数,同时处理多少条数据
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
host: 192.168.10.242
|
host: 127.0.0.1
|
||||||
password: 123456
|
password: 123456
|
||||||
port: 6379
|
port: 6379
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ mysql:
|
|||||||
host: 127.0.0.1:3306
|
host: 127.0.0.1:3306
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
db-name: pandax_iot
|
db-name: pandax
|
||||||
config: charset=utf8&loc=Local&parseTime=true
|
config: charset=utf8&loc=Local&parseTime=true
|
||||||
|
|
||||||
postgresql:
|
postgresql:
|
||||||
@@ -65,7 +65,7 @@ oss:
|
|||||||
taos:
|
taos:
|
||||||
username: "root"
|
username: "root"
|
||||||
password: "taosdata"
|
password: "taosdata"
|
||||||
host: "192.168.10.242:6041"
|
host: "127.0.0.1:6041"
|
||||||
database: "iot"
|
database: "iot"
|
||||||
config: ""
|
config: ""
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package nodes
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"github.com/PandaXGO/PandaKit/utils"
|
||||||
"pandax/apps/device/entity"
|
"pandax/apps/device/entity"
|
||||||
"pandax/apps/device/services"
|
"pandax/apps/device/services"
|
||||||
"pandax/kit/utils"
|
|
||||||
"pandax/pkg/global"
|
"pandax/pkg/global"
|
||||||
"pandax/pkg/rule_engine/message"
|
"pandax/pkg/rule_engine/message"
|
||||||
"time"
|
"time"
|
||||||
@@ -55,7 +55,7 @@ func (n *createAlarmNode) Handle(msg *message.Message) error {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alarm = &entity.DeviceAlarm{}
|
alarm = &entity.DeviceAlarm{}
|
||||||
alarm.Id = utils.GenerateID()
|
alarm.Id = utils.GenerateID("")
|
||||||
alarm.DeviceId = msg.Metadata.GetStringValue("deviceId")
|
alarm.DeviceId = msg.Metadata.GetStringValue("deviceId")
|
||||||
alarm.ProductId = msg.Metadata.GetStringValue("productId")
|
alarm.ProductId = msg.Metadata.GetStringValue("productId")
|
||||||
alarm.Name = msg.Metadata.GetStringValue("deviceName")
|
alarm.Name = msg.Metadata.GetStringValue("deviceName")
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package nodes
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"github.com/PandaXGO/PandaKit/utils"
|
||||||
"pandax/apps/device/services"
|
"pandax/apps/device/services"
|
||||||
"pandax/iothub/client/mqttclient"
|
"pandax/iothub/client/mqttclient"
|
||||||
"pandax/iothub/client/tcpclient"
|
"pandax/iothub/client/tcpclient"
|
||||||
"pandax/iothub/client/udpclient"
|
"pandax/iothub/client/udpclient"
|
||||||
"pandax/kit/utils"
|
|
||||||
devicerpc "pandax/pkg/device_rpc"
|
devicerpc "pandax/pkg/device_rpc"
|
||||||
"pandax/pkg/global"
|
"pandax/pkg/global"
|
||||||
"pandax/pkg/rule_engine/message"
|
"pandax/pkg/rule_engine/message"
|
||||||
@@ -80,7 +80,7 @@ func (n *rpcRequestFromDeviceNode) Handle(msg *message.Message) error {
|
|||||||
rpc := &mqttclient.RpcRequest{}
|
rpc := &mqttclient.RpcRequest{}
|
||||||
if n.RequestId == "" {
|
if n.RequestId == "" {
|
||||||
if msg.Metadata.GetStringValue("requestId") == "" {
|
if msg.Metadata.GetStringValue("requestId") == "" {
|
||||||
rpc.RequestId = utils.GenerateID()
|
rpc.RequestId = utils.GenerateID("")
|
||||||
} else {
|
} else {
|
||||||
rpc.RequestId = msg.Metadata.GetStringValue("requestId")
|
rpc.RequestId = msg.Metadata.GetStringValue("requestId")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package nodes
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"github.com/PandaXGO/PandaKit/utils"
|
||||||
"pandax/apps/device/entity"
|
"pandax/apps/device/entity"
|
||||||
"pandax/apps/device/services"
|
"pandax/apps/device/services"
|
||||||
"pandax/iothub/client/mqttclient"
|
"pandax/iothub/client/mqttclient"
|
||||||
"pandax/iothub/client/tcpclient"
|
"pandax/iothub/client/tcpclient"
|
||||||
"pandax/iothub/client/udpclient"
|
"pandax/iothub/client/udpclient"
|
||||||
"pandax/kit/utils"
|
|
||||||
"pandax/pkg/global"
|
"pandax/pkg/global"
|
||||||
"pandax/pkg/global/model"
|
"pandax/pkg/global/model"
|
||||||
"pandax/pkg/rule_engine/message"
|
"pandax/pkg/rule_engine/message"
|
||||||
@@ -60,7 +60,7 @@ func (n *rpcRequestToDeviceNode) Handle(msg *message.Message) error {
|
|||||||
|
|
||||||
// 构建指令记录
|
// 构建指令记录
|
||||||
var data entity.DeviceCmdLog
|
var data entity.DeviceCmdLog
|
||||||
data.Id = utils.GenerateID()
|
data.Id = utils.GenerateID("")
|
||||||
data.DeviceId = deviceId
|
data.DeviceId = deviceId
|
||||||
data.CmdName = datas.Method
|
data.CmdName = datas.Method
|
||||||
data.CmdContent = kgo.KConv.ToStr(datas.Params)
|
data.CmdContent = kgo.KConv.ToStr(datas.Params)
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/PandaXGO/PandaKit/httpclient"
|
||||||
"net/url"
|
"net/url"
|
||||||
"pandax/kit/httpclient"
|
|
||||||
"pandax/pkg/rule_engine/message"
|
"pandax/pkg/rule_engine/message"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ func (s *HttpServer) Type() Type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *HttpServer) Start(ctx context.Context) error {
|
func (s *HttpServer) Start(ctx context.Context) error {
|
||||||
global.Log.Infof("HTTP Server listen: %s", s.Addr)
|
|
||||||
go func() {
|
go func() {
|
||||||
if global.Conf.Server.Tls.Enable {
|
if global.Conf.Server.Tls.Enable {
|
||||||
global.Log.Infof("HTTPS Server listen: %s", s.Addr)
|
global.Log.Infof("HTTPS Server listen: %s", s.Addr)
|
||||||
|
|||||||
Reference in New Issue
Block a user