entity

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SEO 配置
	ConfigKeySiteTitle       = "site_title"
	ConfigKeySiteDescription = "site_description"
	ConfigKeyKeywords        = "keywords"
	ConfigKeyAuthor          = "author"
	ConfigKeyCopyright       = "copyright"

	// 自动处理配置组
	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"

	// 其他配置
	ConfigKeyPageSize        = "page_size"
	ConfigKeyMaintenanceMode = "maintenance_mode"
)

ConfigKey 配置键常量

View Source
const (
	ConfigTypeString = "string"
	ConfigTypeInt    = "int"
	ConfigTypeBool   = "bool"
	ConfigTypeJSON   = "json"
)

ConfigType 配置类型常量

View Source
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"

	// 其他配置字段
	ConfigResponseFieldPageSize        = "page_size"
	ConfigResponseFieldMaintenanceMode = "maintenance_mode"
)

ConfigResponseField API响应字段名常量

View Source
const (
	// SEO 配置默认值
	ConfigDefaultSiteTitle       = "老九网盘资源数据库"
	ConfigDefaultSiteDescription = "专业的老九网盘资源数据库"
	ConfigDefaultKeywords        = "网盘,资源管理,文件分享"
	ConfigDefaultAuthor          = "系统管理员"
	ConfigDefaultCopyright       = "© 2024 老九网盘资源数据库"

	// 自动处理配置默认值
	ConfigDefaultAutoProcessReadyResources = "false"
	ConfigDefaultAutoProcessInterval       = "30"
	ConfigDefaultAutoTransferEnabled       = "false"
	ConfigDefaultAutoTransferLimitDays     = "0"
	ConfigDefaultAutoTransferMinSpace      = "100"
	ConfigDefaultAutoFetchHotDramaEnabled  = "false"

	// API配置默认值
	ConfigDefaultApiToken = ""

	// 违禁词配置默认值
	ConfigDefaultForbiddenWords = ""

	// 其他配置默认值
	ConfigDefaultPageSize        = "100"
	ConfigDefaultMaintenanceMode = "false"
)

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 分类模型

func (Category) TableName

func (Category) TableName() string

TableName 指定表名

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表

func (Cks) TableName

func (Cks) TableName() string

TableName 指定表名

type DailySearchStat

type DailySearchStat struct {
	Date           time.Time `json:"date"`
	TotalSearches  int       `json:"total_searches"`
	UniqueKeywords int       `json:"unique_keywords"`
}

DailySearchStat 每日搜索统计

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 热播剧实体

func (HotDrama) TableName

func (HotDrama) TableName() string

TableName 指定表名

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 第三方平台表

func (Pan) TableName

func (Pan) TableName() string

TableName 指定表名

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 待处理资源模型

func (ReadyResource) TableName

func (ReadyResource) TableName() string

TableName 指定表名

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 资源模型

func (Resource) TableName

func (Resource) TableName() string

TableName 指定表名

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 资源标签关联表

func (ResourceTag) TableName

func (ResourceTag) 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 搜索统计模型

func (SearchStat) TableName

func (SearchStat) TableName() string

TableName 指定表名

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:"size:1000"`
	Type  string `json:"type" gorm:"size:20;default:'string'"` // string, int, bool, json
}

SystemConfig 系统配置实体(键值对形式)

func (SystemConfig) TableName

func (SystemConfig) TableName() string

TableName 指定表名

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 标签模型

func (Tag) TableName

func (Tag) TableName() string

TableName 指定表名

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 用户模型

func (User) TableName

func (User) TableName() string

TableName 指定表名

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL