更改ID太长问题

This commit is contained in:
XM-GO
2023-09-19 10:18:50 +08:00
parent 4794e32106
commit a7d0cec2bf
16 changed files with 135 additions and 25 deletions

View File

@@ -2,12 +2,12 @@ package nodes
import (
"encoding/json"
"github.com/kakuilan/kgo"
"github.com/sirupsen/logrus"
"pandax/apps/device/entity"
"pandax/apps/device/services"
"pandax/pkg/global"
"pandax/pkg/rule_engine/message"
"pandax/pkg/tool"
"time"
)
@@ -52,7 +52,7 @@ func (n *createAlarmNode) Handle(msg *message.Message) error {
}
} else {
alarm = &entity.DeviceAlarm{}
alarm.Id = kgo.KStr.Uniqid("a")
alarm.Id = tool.GenerateID()
alarm.DeviceId = msg.Metadata.GetValue("deviceId").(string)
alarm.ProductId = msg.Metadata.GetValue("productId").(string)
alarm.Name = msg.Metadata.GetValue("deviceName").(string)