Documentation
¶
Index ¶
- Constants
- type Category
- type Cks
- type DailySearchStat
- type File
- type HotDrama
- type KeywordStat
- type Pan
- type ReadyResource
- type Resource
- type ResourceTag
- type ResourceView
- type SearchStat
- type SystemConfig
- type Tag
- type Task
- type TaskItem
- func (item *TaskItem) AddProcessLog(message string)
- func (item *TaskItem) GetDisplayName(taskType TaskType) string
- func (item *TaskItem) GetInputData(taskType TaskType) (interface{}, error)
- func (item *TaskItem) GetOutputData(taskType TaskType) (interface{}, error)
- func (item *TaskItem) SetInputData(data interface{}) error
- func (item *TaskItem) SetOutputData(data interface{}) error
- func (TaskItem) TableName() string
- type TaskItemStatus
- type TaskStatus
- type TaskType
- type User
Constants ¶
const ( FileStatusActive = "active" // 正常 FileStatusInactive = "inactive" // 禁用 FileStatusDeleted = "deleted" // 已删除 )
FileStatus 文件状态常量
const ( // SEO 配置 ConfigKeySiteTitle = "site_title" ConfigKeySiteDescription = "site_description" ConfigKeyKeywords = "keywords" ConfigKeyAuthor = "author" ConfigKeyCopyright = "copyright" ConfigKeySiteLogo = "site_logo" // 自动处理配置组 ConfigKeyAutoProcessReadyResources = "auto_process_ready_resources" ConfigKeyAutoProcessInterval = "auto_process_interval" ConfigKeyAutoTransferEnabled = "auto_transfer_enabled" ConfigKeyAutoTransferLimitDays = "auto_transfer_limit_days" ConfigKeyAutoTransferMinSpace = "auto_transfer_min_space" ConfigKeyAutoFetchHotDramaEnabled = "auto_fetch_hot_drama_enabled" // API配置 ConfigKeyApiToken = "api_token" // 违禁词配置 ConfigKeyForbiddenWords = "forbidden_words" // 广告配置 ConfigKeyAdKeywords = "ad_keywords" // 广告关键词 ConfigKeyAutoInsertAd = "auto_insert_ad" // 自动插入广告 // 其他配置 ConfigKeyPageSize = "page_size" ConfigKeyMaintenanceMode = "maintenance_mode" ConfigKeyEnableRegister = "enable_register" // 三方统计配置 ConfigKeyThirdPartyStatsCode = "third_party_stats_code" )
ConfigKey 配置键常量
const ( ConfigTypeString = "string" ConfigTypeInt = "int" ConfigTypeBool = "bool" ConfigTypeJSON = "json" )
ConfigType 配置类型常量
const ( // 基础字段 ConfigResponseFieldID = "id" ConfigResponseFieldCreatedAt = "created_at" ConfigResponseFieldUpdatedAt = "updated_at" // SEO 配置字段 ConfigResponseFieldSiteTitle = "site_title" ConfigResponseFieldSiteDescription = "site_description" ConfigResponseFieldKeywords = "keywords" ConfigResponseFieldAuthor = "author" ConfigResponseFieldCopyright = "copyright" // 自动处理配置字段 ConfigResponseFieldAutoProcessReadyResources = "auto_process_ready_resources" ConfigResponseFieldAutoProcessInterval = "auto_process_interval" ConfigResponseFieldAutoTransferEnabled = "auto_transfer_enabled" ConfigResponseFieldAutoTransferLimitDays = "auto_transfer_limit_days" ConfigResponseFieldAutoTransferMinSpace = "auto_transfer_min_space" ConfigResponseFieldAutoFetchHotDramaEnabled = "auto_fetch_hot_drama_enabled" // API配置字段 ConfigResponseFieldApiToken = "api_token" // 违禁词配置字段 ConfigResponseFieldForbiddenWords = "forbidden_words" // 广告配置字段 ConfigResponseFieldAdKeywords = "ad_keywords" ConfigResponseFieldAutoInsertAd = "auto_insert_ad" // 其他配置字段 ConfigResponseFieldPageSize = "page_size" ConfigResponseFieldMaintenanceMode = "maintenance_mode" ConfigResponseFieldEnableRegister = "enable_register" // 三方统计配置字段 ConfigResponseFieldThirdPartyStatsCode = "third_party_stats_code" )
ConfigResponseField API响应字段名常量
const ( // SEO 配置默认值 ConfigDefaultSiteTitle = "老九网盘资源数据库" ConfigDefaultSiteDescription = "专业的老九网盘资源数据库" ConfigDefaultKeywords = "网盘,资源管理,文件分享" ConfigDefaultAuthor = "系统管理员" ConfigDefaultCopyright = "© 2024 老九网盘资源数据库" // 自动处理配置默认值 ConfigDefaultAutoProcessReadyResources = "false" ConfigDefaultAutoProcessInterval = "30" ConfigDefaultAutoTransferEnabled = "false" ConfigDefaultAutoTransferLimitDays = "0" ConfigDefaultAutoTransferMinSpace = "100" ConfigDefaultAutoFetchHotDramaEnabled = "false" // API配置默认值 ConfigDefaultApiToken = "" // 违禁词配置默认值 ConfigDefaultForbiddenWords = "" // 广告配置默认值 ConfigDefaultAdKeywords = "" ConfigDefaultAutoInsertAd = "" // 其他配置默认值 ConfigDefaultPageSize = "100" ConfigDefaultMaintenanceMode = "false" ConfigDefaultEnableRegister = "true" // 三方统计配置默认值 ConfigDefaultThirdPartyStatsCode = "" )
ConfigDefaultValue 配置默认值常量
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Category ¶
type Category struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
Name string `json:"name" gorm:"size:100;not null;unique;comment:分类名称"`
Description string `json:"description" gorm:"type:text;comment:分类描述"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
// 关联关系
Resources []Resource `json:"resources" gorm:"foreignKey:CategoryID"`
Tags []Tag `json:"tags" gorm:"foreignKey:CategoryID"`
}
Category 分类模型
type Cks ¶
type Cks struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
PanID uint `json:"pan_id" gorm:"not null;comment:平台ID"`
Idx int `json:"idx" gorm:"comment:索引"`
Ck string `json:"ck" gorm:"type:text;comment:cookie"`
IsValid bool `json:"is_valid" gorm:"default:true;comment:是否有效"`
Space int64 `json:"space" gorm:"default:0;comment:总空间(字节)"`
LeftSpace int64 `json:"left_space" gorm:"default:0;comment:剩余空间(字节)"`
UsedSpace int64 `json:"used_space" gorm:"default:0;comment:已使用空间(字节)"`
Username string `json:"username" gorm:"size:100;comment:用户名"`
VipStatus bool `json:"vip_status" gorm:"default:false;comment:VIP状态"`
ServiceType string `json:"service_type" gorm:"size:20;comment:服务类型"`
Remark string `json:"remark" gorm:"size:64;not null;comment:备注"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
// 关联关系
Pan Pan `json:"pan" gorm:"foreignKey:PanID"`
}
Cks 第三方平台账号cookie表
type DailySearchStat ¶
type DailySearchStat struct {
Date time.Time `json:"date"`
TotalSearches int `json:"total_searches"`
UniqueKeywords int `json:"unique_keywords"`
}
DailySearchStat 每日搜索统计
type File ¶ added in v1.2.3
type File struct {
ID uint `json:"id" gorm:"primaryKey"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// 文件信息
OriginalName string `json:"original_name" gorm:"size:255;not null;comment:原始文件名"`
FileName string `json:"file_name" gorm:"size:255;not null;unique;comment:存储文件名"`
FilePath string `json:"file_path" gorm:"size:500;not null;comment:文件路径"`
FileSize int64 `json:"file_size" gorm:"not null;comment:文件大小(字节)"`
FileType string `json:"file_type" gorm:"size:100;not null;comment:文件类型"`
MimeType string `json:"mime_type" gorm:"size:100;comment:MIME类型"`
FileHash string `json:"file_hash" gorm:"size:64;uniqueIndex;comment:文件哈希值"`
// 访问信息
AccessURL string `json:"access_url" gorm:"size:500;comment:访问URL"`
// 用户信息
UserID uint `json:"user_id" gorm:"comment:上传用户ID"`
User User `json:"user" gorm:"foreignKey:UserID"`
// 状态信息
Status string `json:"status" gorm:"size:20;default:'active';comment:文件状态"`
IsPublic bool `json:"is_public" gorm:"default:true;comment:是否公开"`
IsDeleted bool `json:"is_deleted" gorm:"default:false;comment:是否已删除"`
}
File 文件实体
type HotDrama ¶
type HotDrama struct {
ID uint `json:"id" gorm:"primaryKey"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// 基本信息
Title string `json:"title" gorm:"size:255;not null"` // 剧名
CardSubtitle string `json:"card_subtitle" gorm:"size:500"` // 副标题
EpisodesInfo string `json:"episodes_info" gorm:"size:100"` // 集数信息
IsNew bool `json:"is_new" gorm:"default:false"` // 是否新剧
Rating float64 `json:"rating" gorm:"default:0"` // 评分
RatingCount int `json:"rating_count" gorm:"default:0"` // 评分人数
Year string `json:"year" gorm:"size:10"` // 年份
Region string `json:"region" gorm:"size:100"` // 地区
Genres string `json:"genres" gorm:"size:500"` // 类型(多个用逗号分隔)
Directors string `json:"directors" gorm:"size:500"` // 导演(多个用逗号分隔)
Actors string `json:"actors" gorm:"size:1000"` // 演员(多个用逗号分隔)
PosterURL string `json:"poster_url" gorm:"size:500"` // 海报URL
// 分类信息
Category string `json:"category" gorm:"size:50"` // 分类(电影/电视剧)
SubType string `json:"sub_type" gorm:"size:50"` // 子类型(华语/欧美/韩国/日本等)
// 数据来源
Source string `json:"source" gorm:"size:50;default:'douban'"` // 数据来源
DoubanID string `json:"douban_id" gorm:"size:50"` // 豆瓣ID
DoubanURI string `json:"douban_uri" gorm:"size:200"` // 豆瓣链接
}
HotDrama 热播剧实体
type KeywordStat ¶
type KeywordStat struct {
Keyword string `json:"keyword"`
Count int `json:"count"`
Rank int `json:"rank"`
}
KeywordStat 关键词统计
type Pan ¶
type Pan struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
Name string `json:"name" gorm:"size:64;comment:平台名称"`
Key int `json:"key" gorm:"comment:平台标识"`
Icon string `json:"icon" gorm:"size:128;comment:图标文字"`
Remark string `json:"remark" gorm:"size:64;not null;comment:备注"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
// 关联关系
Cks []Cks `json:"cks" gorm:"foreignKey:PanID"`
}
Pan 第三方平台表
type ReadyResource ¶
type ReadyResource struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
Title *string `json:"title" gorm:"size:255;comment:资源标题"`
Description string `json:"description" gorm:"type:text;comment:资源描述"`
URL string `json:"url" gorm:"size:500;not null;comment:资源链接"`
Category string `json:"category" gorm:"size:100;comment:资源分类"`
Tags string `json:"tags" gorm:"size:500;comment:资源标签,多个标签用逗号分隔"`
Img string `json:"img" gorm:"size:500;comment:封面链接"`
Source string `json:"source" gorm:"size:100;comment:数据来源"`
Extra string `json:"extra" gorm:"type:text;comment:额外附加数据"`
Key string `json:"key" gorm:"size:64;index;comment:资源组标识,相同key表示同一组资源"`
ErrorMsg string `json:"error_msg" gorm:"type:text;comment:处理失败时的错误信息"`
CreateTime time.Time `json:"create_time" gorm:"default:CURRENT_TIMESTAMP"`
IP *string `json:"ip" gorm:"size:45;comment:IP地址"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
}
ReadyResource 待处理资源模型
type Resource ¶
type Resource struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
Title string `json:"title" gorm:"size:255;not null;comment:资源标题"`
Description string `json:"description" gorm:"type:text;comment:资源描述"`
URL string `json:"url" gorm:"size:128;comment:资源链接"`
PanID *uint `json:"pan_id" gorm:"comment:平台ID"`
SaveURL string `json:"save_url" gorm:"size:500;comment:转存后的链接"`
FileSize string `json:"file_size" gorm:"size:100;comment:文件大小"`
CategoryID *uint `json:"category_id" gorm:"comment:分类ID"`
ViewCount int `json:"view_count" gorm:"default:0;comment:浏览次数"`
IsValid bool `json:"is_valid" gorm:"default:true;comment:是否有效"`
IsPublic bool `json:"is_public" gorm:"default:true;comment:是否公开"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
Cover string `json:"cover" gorm:"size:500;comment:封面"`
Author string `json:"author" gorm:"size:100;comment:作者"`
ErrorMsg string `json:"error_msg" gorm:"size:255;comment:转存失败原因"`
CkID *uint `json:"ck_id" gorm:"comment:账号ID"`
Fid string `json:"fid" gorm:"size:128;comment:网盘文件ID"`
Key string `json:"key" gorm:"size:64;index;comment:资源组标识,相同key表示同一组资源"`
// 关联关系
Category Category `json:"category" gorm:"foreignKey:CategoryID"`
Pan Pan `json:"pan" gorm:"foreignKey:PanID"`
Tags []Tag `json:"tags" gorm:"many2many:resource_tags;"`
}
Resource 资源模型
type ResourceTag ¶
type ResourceTag struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
ResourceID uint `json:"resource_id" gorm:"not null;comment:资源ID"`
TagID uint `json:"tag_id" gorm:"not null;comment:标签ID"`
CreatedAt time.Time `json:"created_at"`
}
ResourceTag 资源标签关联表
type ResourceView ¶ added in v1.2.0
type ResourceView struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
ResourceID uint `json:"resource_id" gorm:"not null;index;comment:资源ID"`
IPAddress string `json:"ip_address" gorm:"size:45;comment:访问者IP地址"`
UserAgent string `json:"user_agent" gorm:"type:text;comment:用户代理"`
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime;comment:访问时间"`
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
// 关联关系
Resource Resource `json:"resource" gorm:"foreignKey:ResourceID"`
}
ResourceView 资源访问记录
func (ResourceView) TableName ¶ added in v1.2.0
func (ResourceView) TableName() string
TableName 指定表名
type SearchStat ¶
type SearchStat struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
Keyword string `json:"keyword" gorm:"size:255;not null;comment:搜索关键词"`
Count int `json:"count" gorm:"default:1;comment:搜索次数"`
Date time.Time `json:"date" gorm:"type:date;not null;comment:搜索日期"`
IP string `json:"ip" gorm:"size:45;comment:用户IP"`
UserAgent string `json:"user_agent" gorm:"size:500;comment:用户代理"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
}
SearchStat 搜索统计模型
type SystemConfig ¶
type SystemConfig struct {
ID uint `json:"id" gorm:"primaryKey"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// 键值对配置
Key string `json:"key" gorm:"size:100;not null;unique;comment:配置键"`
Value string `json:"value" gorm:"type:text"`
Type string `json:"type" gorm:"size:20;default:'string'"` // string, int, bool, json
}
SystemConfig 系统配置实体(键值对形式)
type Tag ¶
type Tag struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
Name string `json:"name" gorm:"size:100;not null;unique;comment:标签名称"`
Description string `json:"description" gorm:"type:text;comment:标签描述"`
CategoryID *uint `json:"category_id" gorm:"comment:分类ID,可以为空"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
// 关联关系
Category Category `json:"category" gorm:"foreignKey:CategoryID"`
Resources []Resource `json:"resources" gorm:"many2many:resource_tags;"`
}
Tag 标签模型
type Task ¶ added in v1.2.0
type Task struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
Title string `json:"title" gorm:"size:255;not null;comment:任务标题"`
Type TaskType `json:"type" gorm:"size:50;not null;comment:任务类型"`
Status TaskStatus `json:"status" gorm:"size:20;not null;default:pending;comment:任务状态"`
Description string `json:"description" gorm:"type:text;comment:任务描述"`
// 进度信息
TotalItems int `json:"total_items" gorm:"not null;default:0;comment:总项目数"`
ProcessedItems int `json:"processed_items" gorm:"not null;default:0;comment:已处理项目数"`
SuccessItems int `json:"success_items" gorm:"not null;default:0;comment:成功项目数"`
FailedItems int `json:"failed_items" gorm:"not null;default:0;comment:失败项目数"`
// 任务配置 (JSON格式存储)
Config string `json:"config" gorm:"type:text;comment:任务配置"`
// 任务消息
Message string `json:"message" gorm:"type:text;comment:任务消息"`
// 时间信息
StartedAt *time.Time `json:"started_at" gorm:"comment:开始时间"`
CompletedAt *time.Time `json:"completed_at" gorm:"comment:完成时间"`
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
// 关联关系
TaskItems []TaskItem `json:"task_items" gorm:"foreignKey:TaskID"`
}
Task 任务表
type TaskItem ¶ added in v1.2.0
type TaskItem struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
TaskID uint `json:"task_id" gorm:"not null;index;comment:任务ID"`
// 通用任务项信息
Status TaskItemStatus `json:"status" gorm:"size:20;not null;default:pending;comment:处理状态"`
ErrorMessage string `json:"error_message" gorm:"type:text;comment:错误信息"`
// 输入数据 (JSON格式存储,支持不同任务类型的不同数据结构)
InputData string `json:"input_data" gorm:"type:text;not null;comment:输入数据(JSON格式)"`
// 输出数据 (JSON格式存储,支持不同任务类型的不同结果数据)
OutputData string `json:"output_data" gorm:"type:text;comment:输出数据(JSON格式)"`
// 处理日志 (可选,用于记录详细的处理过程)
ProcessLog string `json:"process_log" gorm:"type:text;comment:处理日志"`
// 时间信息
ProcessedAt *time.Time `json:"processed_at" gorm:"comment:处理时间"`
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
// 关联关系
Task Task `json:"task" gorm:"foreignKey:TaskID"`
}
TaskItem 任务项表(任务的详细记录)
func (*TaskItem) AddProcessLog ¶ added in v1.2.0
AddProcessLog 添加处理日志
func (*TaskItem) GetDisplayName ¶ added in v1.2.0
GetDisplayName 获取显示名称(用于前端显示)
func (*TaskItem) GetInputData ¶ added in v1.2.0
GetInputData 获取输入数据(根据任务类型解析JSON)
func (*TaskItem) GetOutputData ¶ added in v1.2.0
GetOutputData 获取输出数据(根据任务类型解析JSON)
func (*TaskItem) SetInputData ¶ added in v1.2.0
SetInputData 设置输入数据(将结构体转换为JSON字符串)
func (*TaskItem) SetOutputData ¶ added in v1.2.0
SetOutputData 设置输出数据(将结构体转换为JSON字符串)
type TaskItemStatus ¶ added in v1.2.0
type TaskItemStatus string
TaskItemStatus 任务项状态
const ( TaskItemStatusPending TaskItemStatus = "pending" // 等待处理 TaskItemStatusProcessing TaskItemStatus = "processing" // 处理中 TaskItemStatusSuccess TaskItemStatus = "success" // 成功 TaskItemStatusFailed TaskItemStatus = "failed" // 失败 TaskItemStatusSkipped TaskItemStatus = "skipped" // 跳过 )
type TaskStatus ¶ added in v1.2.0
type TaskStatus string
TaskStatus 任务状态
const ( TaskStatusPending TaskStatus = "pending" // 等待中 TaskStatusRunning TaskStatus = "running" // 运行中 TaskStatusPaused TaskStatus = "paused" // 已暂停 TaskStatusCompleted TaskStatus = "completed" // 已完成 TaskStatusFailed TaskStatus = "failed" // 失败 TaskStatusCancelled TaskStatus = "cancelled" // 已取消 )
type TaskType ¶ added in v1.2.0
type TaskType string
TaskType 任务类型
const (
TaskTypeBatchTransfer TaskType = "batch_transfer" // 批量转存
)
type User ¶
type User struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
Username string `json:"username" gorm:"size:50;not null;unique;comment:用户名"`
Password string `json:"-" gorm:"size:255;not null;comment:密码"`
Email string `json:"email" gorm:"size:100;comment:邮箱"`
Role string `json:"role" gorm:"size:20;default:'user';comment:角色"`
IsActive bool `json:"is_active" gorm:"default:true;comment:是否激活"`
LastLogin *time.Time `json:"last_login" gorm:"comment:最后登录时间"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
}
User 用户模型