camera.go 1.8 KB

12345678910111213141516171819202122232425262728
  1. package dao
  2. import "wails-app/internal/global"
  3. // Camera 摄像头模型
  4. type Camera struct {
  5. global.GVA_MODEL
  6. DeviceCode string `gorm:"size:50;not null;uniqueIndex" json:"device_code"` // 设备编码
  7. DeviceName string `gorm:"size:100;not null" json:"device_name"` // 设备名称
  8. ChannelID uint `gorm:"index;comment:绑定通道ID" json:"channel_id"`
  9. BoundChannel *Channel `gorm:"foreignKey:ChannelID;references:ID" json:"channel_binding"`
  10. IPAddress string `gorm:"size:50;not null" json:"ip_address"` // IP地址
  11. Port int `gorm:"not null" json:"port"` // 端口
  12. Username string `gorm:"size:50" json:"username"` // 用户名
  13. Password string `gorm:"size:50" json:"password"` // 密码
  14. Channel int `gorm:"default:1" json:"channel"` // 通道号
  15. Status string `gorm:"size:20;default:'offline'" json:"status"` // 连接状态
  16. IsActive bool `gorm:"default:true" json:"is_active"` // 是否启用
  17. StreamProtocol string `gorm:"size:20;default:'webrtc'" json:"stream_protocol"` // system-mjpeg / webrtc / hls / mp4
  18. SourceURL string `gorm:"size:500" json:"source_url"` // 系统转换模式下的原始 RTSP/HTTP 地址
  19. StreamURL string `gorm:"size:500" json:"stream_url"` // 边缘转换后的浏览器播放地址,不应包含设备凭据
  20. SnapshotURL string `gorm:"size:500" json:"snapshot_url"` // 可选抓拍地址
  21. Description string `gorm:"size:200" json:"description"` // 备注
  22. }
  23. func (Camera) TableName() string {
  24. return "camera"
  25. }