entity

package
v1.0.9 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

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:额外附加数据"`
	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"`

	// 关联关系
	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"`

	// SEO 配置
	SiteTitle       string `json:"site_title" gorm:"size:200;not null;default:'老九网盘资源数据库'"`
	SiteDescription string `json:"site_description" gorm:"size:500"`
	Keywords        string `json:"keywords" gorm:"size:500"`
	Author          string `json:"author" gorm:"size:100"`
	Copyright       string `json:"copyright" gorm:"size:200"`

	// 自动处理配置组
	AutoProcessReadyResources bool `json:"auto_process_ready_resources" gorm:"default:false"` // 自动处理待处理资源
	AutoProcessInterval       int  `json:"auto_process_interval" gorm:"default:30"`           // 自动处理间隔(分钟)
	AutoTransferEnabled       bool `json:"auto_transfer_enabled" gorm:"default:false"`        // 开启自动转存
	AutoTransferLimitDays     int  `json:"auto_transfer_limit_days" gorm:"default:0"`         // 自动转存限制天数(0表示不限制)
	AutoTransferMinSpace      int  `json:"auto_transfer_min_space" gorm:"default:100"`        // 最小存储空间(GB)
	AutoFetchHotDramaEnabled  bool `json:"auto_fetch_hot_drama_enabled" gorm:"default:false"` // 自动拉取热播剧名字

	// API配置
	ApiToken string `json:"api_token" gorm:"size:100;uniqueIndex"` // 公开API访问令牌

	// 其他配置
	PageSize        int  `json:"page_size" gorm:"default:100"`
	MaintenanceMode bool `json:"maintenance_mode" gorm:"default:false"`
}

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