uint/uint64全部改为uint32
This commit is contained in:
@@ -14,12 +14,12 @@ import (
|
||||
|
||||
// AreaThresholdCheckParams 定义了区域阈值检查任务的参数
|
||||
type AreaThresholdCheckParams struct {
|
||||
AreaControllerID uint `json:"area_controller_id"` // 区域主控ID
|
||||
AreaControllerID uint32 `json:"area_controller_id"` // 区域主控ID
|
||||
SensorType models.SensorType `json:"sensor_type"` // 传感器类型
|
||||
Thresholds float32 `json:"thresholds"` // 阈值
|
||||
Operator models.Operator `json:"operator"` // 操作符
|
||||
Level models.SeverityLevel `json:"level"` // 告警级别
|
||||
ExcludeDeviceIDs []uint `json:"exclude_device_ids"` // 排除的传感器ID
|
||||
ExcludeDeviceIDs []uint32 `json:"exclude_device_ids"` // 排除的传感器ID
|
||||
}
|
||||
|
||||
// AreaThresholdCheckTask 是一个任务,用于检查区域阈值并触发告警, 区域主控下的所有没有独立校验任务的设备都会受到此任务的检查
|
||||
@@ -62,7 +62,7 @@ func (a *AreaThresholdCheckTask) Execute(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// 构建忽略设备ID的map,方便快速查找
|
||||
ignoredMap := make(map[uint]struct{})
|
||||
ignoredMap := make(map[uint32]struct{})
|
||||
for _, id := range a.params.ExcludeDeviceIDs {
|
||||
ignoredMap[id] = struct{}{}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ func (a *AreaThresholdCheckTask) OnFailure(ctx context.Context, executeErr error
|
||||
logger.Errorf("区域阈值检测任务执行失败, 任务ID: %v: 执行失败: %v", a.taskLog.TaskID, executeErr)
|
||||
}
|
||||
|
||||
func (a *AreaThresholdCheckTask) ResolveDeviceIDs(ctx context.Context) ([]uint, error) {
|
||||
func (a *AreaThresholdCheckTask) ResolveDeviceIDs(ctx context.Context) ([]uint32, error) {
|
||||
taskCtx := logs.AddFuncName(ctx, a.ctx, "ResolveDeviceIDs")
|
||||
if err := a.parseParameters(taskCtx); err != nil {
|
||||
return nil, err
|
||||
@@ -156,7 +156,7 @@ func (a *AreaThresholdCheckTask) parseParameters(ctx context.Context) error {
|
||||
params.Level = models.WarnLevel
|
||||
}
|
||||
if params.ExcludeDeviceIDs == nil {
|
||||
params.ExcludeDeviceIDs = []uint{}
|
||||
params.ExcludeDeviceIDs = []uint32{}
|
||||
}
|
||||
|
||||
a.params = params
|
||||
|
||||
Reference in New Issue
Block a user