This commit is contained in:
PandaX-Go
2024-08-29 21:58:27 +08:00
parent 5b2b068e40
commit 315c0a6c27
6 changed files with 14 additions and 15 deletions

View File

@@ -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")

View File

@@ -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")
}

View File

@@ -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)

View File

@@ -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"
)