2024-11-14 14:55:43 +00:00
|
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"gorm.io/gorm"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type DeviceLog struct {
|
|
|
|
|
gorm.Model
|
|
|
|
|
DeviceUID string `gorm:"index" json:"device_uid"` // 设备UID
|
2024-11-16 15:59:15 +00:00
|
|
|
|
Action string `json:"action"` // 操作类型:register/start/verify/bind/unbind
|
2024-11-14 14:55:43 +00:00
|
|
|
|
Message string `json:"message"` // 详细信息
|
|
|
|
|
Status string `json:"status"` // 状态:success/failed
|
2024-11-16 15:59:15 +00:00
|
|
|
|
IP string `json:"ip"` // 操作IP
|
2024-11-14 14:55:43 +00:00
|
|
|
|
}
|
2024-11-16 15:59:15 +00:00
|
|
|
|
|
|
|
|
|
// 定义日志操作类型常量
|
|
|
|
|
const (
|
|
|
|
|
LogActionRegister = "register"
|
|
|
|
|
LogActionStart = "start"
|
|
|
|
|
LogActionVerify = "verify"
|
|
|
|
|
LogActionBind = "bind"
|
|
|
|
|
LogActionUnbind = "unbind"
|
|
|
|
|
)
|