package models import ( "time" ) // DownlinkTaskRecord 记录下行任务的下发情况和设备确认状态 type DownlinkTaskRecord struct { // MessageID 是下行消息的唯一标识符。 // 可以是 ChirpStack 的 DeduplicationID 或其他系统生成的ID。 MessageID string `gorm:"uniqueIndex;not null" json:"message_id"` // DeviceID 是接收此下行任务的设备的ID。 // 对于 LoRaWAN,这通常是区域主控设备的ID。 DeviceID uint `gorm:"not null;index" json:"device_id"` // SentAt 记录下行任务最初发送的时间。 SentAt time.Time `gorm:"not null" json:"sent_at"` // AcknowledgedAt 记录设备确认收到下行消息的时间。 // 如果设备未确认,则为零值或 NULL。使用指针类型 *time.Time 允许 NULL 值。 AcknowledgedAt *time.Time `json:"acknowledged_at"` } // TableName 自定义 GORM 使用的数据库表名 func (DownlinkTaskRecord) TableName() string { return "downlink_task_records" }