package model import "time" // DeviceCommandLog 设备指令日志 type DeviceCommandLog struct { ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"` // = commandId (Snowflake) DockID string `gorm:"column:dock_id;type:VARCHAR(64);not null" json:"dockId"` CommandType string `gorm:"column:command_type;type:VARCHAR(64);not null" json:"commandType"` // dock.open / drone.takeoff / workflow.start_task Params string `gorm:"column:params;type:JSON" json:"params"` DroneSN string `gorm:"column:drone_sn;type:VARCHAR(32)" json:"droneSn"` RequestID string `gorm:"column:request_id;type:VARCHAR(64)" json:"requestId"` TTLMs int `gorm:"column:ttl_ms;type:INT;default:30000" json:"ttlMs"` AckAccepted int8 `gorm:"column:ack_accepted;type:TINYINT" json:"ackAccepted"` AckResultCode string `gorm:"column:ack_result_code;type:VARCHAR(64)" json:"ackResultCode"` Status string `gorm:"column:status;type:VARCHAR(16);default:sent" json:"status"` // sent / acked / timeout / terminal RetryCount int `gorm:"column:retry_count;type:INT;default:0" json:"retryCount"` SentAt *time.Time `gorm:"column:sent_at" json:"sentAt"` AckedAt *time.Time `gorm:"column:acked_at" json:"ackedAt"` CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"` } func (DeviceCommandLog) TableName() string { return "device_command_log" }