功能: - 前台导航: 分类Tab切换、实时搜索、健康状态指示、响应式适配 - 后台管理: 服务/分类CRUD、系统设置、登录认证(bcrypt) - 健康检查: 定时检测(5min)、独立检查URL、三态指示(在线/离线/未检测) - 云端备份: WebDAV上传/下载/恢复/删除、定时自动备份、本地备份管理 技术栈: Go + Gin + GORM + SQLite
46 lines
1.6 KiB
Go
46 lines
1.6 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type Category struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
Name string `gorm:"unique;not null" json:"name"`
|
|
SortOrder int `gorm:"default:0" json:"sort_order"`
|
|
Services []Service `gorm:"foreignKey:CategoryID" json:"services"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type Service struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
Name string `gorm:"not null" json:"name"`
|
|
URL string `gorm:"not null" json:"url"`
|
|
Description string `json:"description"`
|
|
Icon string `json:"icon"`
|
|
CategoryID uint `gorm:"index" json:"category_id"`
|
|
Status string `gorm:"default:'online'" json:"status"`
|
|
Tags string `json:"tags"`
|
|
IsEnabled bool `gorm:"default:true" json:"is_enabled"`
|
|
SortOrder int `gorm:"default:0" json:"sort_order"`
|
|
ClickCount int `gorm:"default:0" json:"click_count"`
|
|
HealthCheckURL string `json:"health_check_url"`
|
|
HealthCheckEnabled bool `gorm:"default:false" json:"health_check_enabled"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type User struct {
|
|
ID uint `gorm:"primaryKey"`
|
|
Username string `gorm:"unique;not null"`
|
|
Password string `gorm:"not null"`
|
|
MustChangePassword bool `gorm:"default:true"`
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
type Setting struct {
|
|
Key string `gorm:"primaryKey"`
|
|
Value string
|
|
}
|