models

package
v0.0.0-...-118bb3a Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminLog

type AdminLog struct {
	ID         uint      `json:"id" gorm:"primaryKey"`
	UserID     uint      `json:"user_id"`     // 操作用户ID
	Username   string    `json:"username"`    // 操作用户名
	Action     string    `json:"action"`      // 操作类型
	Resource   string    `json:"resource"`    // 资源类型
	ResourceID uint      `json:"resource_id"` // 资源ID
	Details    string    `json:"details"`     // 操作详情
	IP         string    `json:"ip"`          // 操作IP
	UserAgent  string    `json:"user_agent"`  // 用户代理
	CreatedAt  time.Time `json:"created_at" gorm:"index"`
}

AdminLog 管理员操作日志

type CategoryPermission

type CategoryPermission struct {
	ID         uint      `json:"id" gorm:"primaryKey"`
	CategoryID uint      `json:"category_id"`
	RoleID     uint      `json:"role_id"`
	CreatedAt  time.Time `json:"created_at"`
	CreatedBy  uint      `json:"created_by"`

	// 关联
	Category *NoteCategory `json:"category,omitempty"`
	Role     *Role         `json:"role,omitempty"`
}

CategoryPermission 分类权限

func (CategoryPermission) TableName

func (CategoryPermission) TableName() string

type Comment

type Comment struct {
	ID        int64     `json:"id" gorm:"primaryKey"`
	IssueID   int64     `json:"issue_id" gorm:"not null;index"`
	UserID    int64     `json:"user_id" gorm:"not null;index"`
	Content   string    `json:"content" gorm:"type:text;not null"`
	CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
}

type ConfigExport

type ConfigExport struct {
	ID        uint      `json:"id" gorm:"primaryKey"`
	ProjectID uint      `json:"project_id" gorm:"index"`                 // 所属项目ID
	TableID   uint      `json:"table_id" gorm:"index"`                   // 配置表ID
	Format    string    `json:"format" gorm:"size:20;not null"`          // 导出格式:binary, json, bson, xml, lua, yaml
	Language  string    `json:"language" gorm:"size:20;not null"`        // 目标语言:cpp, java, go, cs, python, lua
	Status    string    `json:"status" gorm:"size:20;default:'pending'"` // 状态:pending, running, success, failed
	Output    string    `json:"output" gorm:"type:text"`                 // 导出输出
	Error     string    `json:"error" gorm:"type:text"`                  // 错误信息
	StartTime time.Time `json:"start_time"`                              // 开始时间
	EndTime   time.Time `json:"end_time"`                                // 结束时间
	Duration  int       `json:"duration"`                                // 执行时长(秒)
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

ConfigExport 配置导出记录

type ConfigProject

type ConfigProject struct {
	ID          uint      `json:"id" gorm:"primaryKey"`
	Name        string    `json:"name" gorm:"size:100;not null"`          // 项目名称
	Description string    `json:"description" gorm:"type:text"`           // 项目描述
	RootPath    string    `json:"root_path" gorm:"size:255;not null"`     // 配置根目录
	OutputPath  string    `json:"output_path" gorm:"size:255;not null"`   // 输出目录
	Status      string    `json:"status" gorm:"size:20;default:'active'"` // 状态:active, archived
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

ConfigProject 配置项目表

type ConfigTable

type ConfigTable struct {
	ID          uint      `json:"id" gorm:"primaryKey"`
	ProjectID   uint      `json:"project_id" gorm:"index"`                // 所属项目ID
	Name        string    `json:"name" gorm:"size:100;not null"`          // 配置表名称
	Description string    `json:"description" gorm:"type:text"`           // 配置表描述
	FilePath    string    `json:"file_path" gorm:"size:255;not null"`     // 配置文件路径
	FileType    string    `json:"file_type" gorm:"size:20;not null"`      // 文件类型:excel, csv, json, xml, yaml
	SheetName   string    `json:"sheet_name" gorm:"size:100"`             // Excel工作表名称
	Validators  string    `json:"validators" gorm:"type:text"`            // 数据验证规则(JSON格式)
	Status      string    `json:"status" gorm:"size:20;default:'active'"` // 状态:active, archived
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

ConfigTable 配置表定义

type GameConfExport

type GameConfExport struct {
	ID        uint            `json:"id" gorm:"primaryKey"`
	ProjectID uint            `json:"project_id" gorm:"index"`                 // 所属项目ID
	Project   GameConfProject `json:"project" gorm:"foreignKey:ProjectID"`     // 项目关联
	TableID   uint            `json:"table_id" gorm:"index"`                   // 配置表ID
	Table     GameConfTable   `json:"table" gorm:"foreignKey:TableID"`         // 配置表关联
	Format    string          `json:"format" gorm:"size:20;not null"`          // 导出格式:binary, json, bson, xml, lua, yaml
	Language  string          `json:"language" gorm:"size:20;not null"`        // 目标语言:cpp, java, go, cs, python, lua
	Status    string          `json:"status" gorm:"size:20;default:'pending'"` // 状态:pending, running, success, failed
	Output    string          `json:"output" gorm:"type:text"`                 // 导出输出
	Error     string          `json:"error" gorm:"type:text"`                  // 错误信息
	StartTime time.Time       `json:"start_time"`                              // 开始时间
	EndTime   time.Time       `json:"end_time"`                                // 结束时间
	Duration  int             `json:"duration"`                                // 执行时长(秒)
	CreatedAt time.Time       `json:"created_at"`
	UpdatedAt time.Time       `json:"updated_at"`
}

GameConfExport 游戏配置导出记录

type GameConfProject

type GameConfProject struct {
	ID          uint      `json:"id" gorm:"primaryKey"`
	Name        string    `json:"name" gorm:"size:100;not null"`          // 项目名称
	Description string    `json:"description" gorm:"type:text"`           // 项目描述
	SourcePath  string    `json:"source_path" gorm:"size:255;not null"`   // 数据源目录
	DataPath    string    `json:"data_path" gorm:"size:255;not null"`     // 导出数据目录
	CodePath    string    `json:"code_path" gorm:"size:255;not null"`     // 生成代码目录
	Status      string    `json:"status" gorm:"size:20;default:'active'"` // 状态:active, archived
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

GameConfProject 游戏配置项目

type GameConfTable

type GameConfTable struct {
	ID          uint            `json:"id" gorm:"primaryKey"`
	ProjectID   uint            `json:"project_id" gorm:"index"`                // 所属项目ID
	Project     GameConfProject `json:"project" gorm:"foreignKey:ProjectID"`    // 项目关联
	Name        string          `json:"name" gorm:"size:100;not null"`          // 配置表名称
	Description string          `json:"description" gorm:"type:text"`           // 配置表描述
	FilePath    string          `json:"file_path" gorm:"size:255;not null"`     // 配置文件路径
	FileType    string          `json:"file_type" gorm:"size:20;not null"`      // 文件类型:excel, csv, xls, xlsx, xlsm
	SheetName   string          `json:"sheet_name" gorm:"size:100"`             // Excel工作表名称
	Validators  string          `json:"validators" gorm:"type:text"`            // 数据验证规则(JSON格式)
	Status      string          `json:"status" gorm:"size:20;default:'active'"` // 状态:active, archived
	CreatedAt   time.Time       `json:"created_at"`
	UpdatedAt   time.Time       `json:"updated_at"`
}

GameConfTable 游戏配置表

type GameLog

type GameLog struct {
	ID         uint   `json:"id" gorm:"primaryKey"`
	AppID      string `json:"app_id"`
	Package    string `json:"package"`
	RoleName   string `json:"role_name" gorm:"index:idx_role_name_message, priority:1"`
	Device     string `json:"device"`
	LogMessage string `json:"log_message" gorm:"index:idx_role_name_message, priority:2"`
	LogTime    int64  `json:"log_time" gorm:"index"`
	LogType    string `json:"log_type"`
	LogStack   string `json:"log_stack"`
	CreateAt   int64  `json:"create_at" gorm:"index"`
}

type Issue

type Issue struct {
	ID          int64     `json:"id" gorm:"primaryKey"`
	ProjectID   int64     `json:"project_id" gorm:"not null;index"`
	IterationID int64     `json:"iteration_id" gorm:"index"`
	Title       string    `json:"title" gorm:"size:200;not null"`
	Description string    `json:"description" gorm:"type:text"`
	Type        int       `json:"type" gorm:"not null;default:1"`     // 1: Bug, 2: Feature, 3: Task
	Priority    int       `json:"priority" gorm:"not null;default:2"` // 1: Low, 2: Medium, 3: High, 4: Critical
	Status      int       `json:"status" gorm:"not null;default:1"`   // 1: New, 2: In Progress, 3: Testing, 4: Resolved, 5: Closed
	AssigneeID  int64     `json:"assignee_id" gorm:"index"`
	ReporterID  int64     `json:"reporter_id" gorm:"not null;index"`
	CreatedAt   time.Time `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt   time.Time `json:"updated_at" gorm:"autoUpdateTime"`
}

type Iteration

type Iteration struct {
	ID          int64     `json:"id" gorm:"primaryKey"`
	ProjectID   int64     `json:"project_id" gorm:"not null;index"`
	Name        string    `json:"name" gorm:"size:100;not null"`
	Description string    `json:"description" gorm:"type:text"`
	StartDate   time.Time `json:"start_date" gorm:"not null"`
	EndDate     time.Time `json:"end_date" gorm:"not null"`
	Status      int       `json:"status" gorm:"not null;default:1"` // 1: Planning, 2: In Progress, 3: Completed
	CreatedAt   time.Time `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt   time.Time `json:"updated_at" gorm:"autoUpdateTime"`
}
type Menu struct {
	ID         uint      `gorm:"primarykey" json:"id"`
	ParentID   uint      `gorm:"index" json:"parent_id"`        // 父菜单ID,0表示根菜单
	Name       string    `gorm:"size:50;not null" json:"name"`  // 菜单名称
	Path       string    `gorm:"size:100;not null" json:"path"` // 菜单路径
	Icon       string    `gorm:"size:100" json:"icon"`          // 菜单图标
	Sort       int       `gorm:"default:0" json:"sort"`         // 排序
	Permission string    `gorm:"size:100" json:"permission"`    // 绑定的权限
	IsShow     bool      `gorm:"default:true" json:"is_show"`   // 是否显示
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

Menu 菜单模型

type MenuTree struct {
	Menu     *Menu       `json:"menu"`
	Children []*MenuTree `json:"children"`
}

MenuTree 菜单树结构

type ModuleInit

type ModuleInit struct {
	ID          uint      `json:"id" gorm:"primaryKey"`
	Module      string    `json:"module" gorm:"size:50;index"`
	Initialized uint8     `json:"initialized" gorm:"type:tinyint(1);default:0"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

ModuleInit 模块是否初始化的数据库表

type Note

type Note struct {
	ID         uint      `json:"id" gorm:"primaryKey"`
	Title      string    `json:"title" gorm:"size:200;not null"`
	Content    string    `json:"content" gorm:"type:text;not null"`
	CategoryID uint      `json:"category_id"`
	ParentID   uint      `json:"parent_id" gorm:"default:0"`
	IsPublic   uint8     `json:"is_public" gorm:"type:tinyint(1);default:0"`
	ViewCount  int       `json:"view_count" gorm:"default:0"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
	CreatedBy  uint      `json:"created_by"`
	UpdatedBy  uint      `json:"updated_by"`

	// 关联
	Category *NoteCategory `json:"category,omitempty"`
	Parent   *Note         `json:"parent,omitempty" gorm:"foreignKey:ParentID"`
	Children []*Note       `json:"children,omitempty" gorm:"foreignKey:ParentID"`
	Roles    []*Role       `json:"roles,omitempty" gorm:"many2many:note_permissions"`
}

Note 笔记

func (*Note) HasPermission

func (n *Note) HasPermission(userRoles []uint) bool

检查用户是否有权限访问笔记

func (Note) TableName

func (Note) TableName() string

type NoteCategory

type NoteCategory struct {
	ID          uint      `json:"id" gorm:"primaryKey"`
	Name        string    `json:"name" gorm:"size:100;not null"`
	Description string    `json:"description" gorm:"type:text"`
	ParentID    uint      `json:"parent_id" gorm:"default:0"`
	IsPublic    uint8     `json:"is_public" gorm:"type:tinyint(1);default:0"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	CreatedBy   uint      `json:"created_by"`
	UpdatedBy   uint      `json:"updated_by"`

	// 关联
	Parent   *NoteCategory   `json:"parent,omitempty" gorm:"foreignKey:ParentID"`
	Children []*NoteCategory `json:"children,omitempty" gorm:"foreignKey:ParentID"`
	Notes    []*Note         `json:"notes,omitempty" gorm:"foreignKey:CategoryID"`
	Roles    []*Role         `json:"roles,omitempty" gorm:"many2many:category_permissions"`
}

NoteCategory 笔记分类

func (*NoteCategory) HasPermission

func (c *NoteCategory) HasPermission(userRoles []uint) bool

检查用户是否有权限访问分类

func (NoteCategory) TableName

func (NoteCategory) TableName() string

TableName 指定表名

type NotePermission

type NotePermission struct {
	ID        uint      `json:"id" gorm:"primaryKey"`
	NoteID    uint      `json:"note_id"`
	RoleID    uint      `json:"role_id"`
	CreatedAt time.Time `json:"created_at"`
	CreatedBy uint      `json:"created_by"`

	// 关联
	Note *Note `json:"note,omitempty"`
	Role *Role `json:"role,omitempty"`
}

NotePermission 笔记权限

func (NotePermission) TableName

func (NotePermission) TableName() string

type Permission

type Permission struct {
	ID          uint      `json:"id" gorm:"primaryKey"`
	Name        string    `json:"name" gorm:"uniqueIndex;size:50"`
	Code        string    `json:"code" gorm:"uniqueIndex;size:50"` // 权限编码
	Description string    `json:"description"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

Permission 权限表

type ProcessItem

type ProcessItem struct {
	Name string   `json:"name"`
	List []string `json:"list"`
}

type Project

type Project struct {
	ID          int64     `json:"id" gorm:"primaryKey"`
	Name        string    `json:"name" gorm:"size:100;not null"`
	Description string    `json:"description" gorm:"type:text"`
	StartDate   time.Time `json:"start_date" gorm:"not null"`
	EndDate     time.Time `json:"end_date" gorm:"not null"`
	Status      int       `json:"status" gorm:"not null;default:1"` // 1: Active, 2: Completed, 3: Archived
	CreatedAt   time.Time `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt   time.Time `json:"updated_at" gorm:"autoUpdateTime"`
}

type Role

type Role struct {
	ID          uint         `json:"id" gorm:"primaryKey"`
	Name        string       `json:"name" gorm:"uniqueIndex;size:50"`
	Description string       `json:"description"`
	Permissions []Permission `json:"permissions" gorm:"many2many:role_permissions;"`
	CreatedAt   time.Time    `json:"created_at"`
	UpdatedAt   time.Time    `json:"updated_at"`
}

Role 角色表

type RolePermission

type RolePermission struct {
	RoleID       uint `gorm:"primaryKey"`
	PermissionID uint `gorm:"primaryKey"`
}

RolePermission 角色-权限关联表

type StatsInfo

type StatsInfo struct {
	ID          uint                     `json:"id" gorm:"primaryKey"`
	LoginID     int64                    `json:"login_id" gorm:"index"`
	FPS         int                      `json:"fps"`
	TotalMem    int                      `json:"total_mem"`
	UsedMem     int                      `json:"used_mem"`
	MonoUsedMem int                      `json:"mono_used_mem"`
	MonoHeapMem int                      `json:"mono_heap_mem"`
	Texture     int                      `json:"texture"`
	Mesh        int                      `json:"mesh"`
	Animation   int                      `json:"animation"`
	Audio       int                      `json:"audio"`
	Font        int                      `json:"font"`
	TextAsset   int                      `json:"text_asset"`
	Shader      int                      `json:"shader"`
	Pic         string                   `json:"pic"`
	Process2    []map[string]interface{} `json:"list" gorm:"-"`
	Process     string                   `json:"process"`
	StatTime    int64                    `json:"mtime" gorm:"index"`
	CreatedAt   int64                    `json:"created_at" gorm:"index"`
}

type StatsRecord

type StatsRecord struct {
	ID          uint   `json:"id" gorm:"primaryKey"`
	LoginID     int64  `json:"login_id" gorm:"index:idx_role_at,priority:1,uniqueIndex"`
	AppID       int    `json:"app_id"`
	Package     string `json:"package_name"`
	ProductName string `json:"product_name"`
	RoleName    string `json:"role_name" gorm:"index:idx_role_at,priority:2"`
	Device      string `json:"device_name"`
	CPU         string `json:"system_cpu"`
	GPU         string `json:"graphics_divice"`
	Memory      int    `json:"system_mem"`
	GPUMemory   int    `json:"graphics_mem"`
	StatTime    int64  `json:"mtime" gorm:"index"`
	CreatedAt   int64  `json:"created_at" gorm:"index:idx_role_at,priority:3"`
}

type Task

type Task struct {
	ID          uint      `json:"id" gorm:"primaryKey"`
	Name        string    `json:"name" gorm:"size:100;not null"`                 // 任务名称
	Description string    `json:"description" gorm:"type:text"`                  // 任务描述
	Type        string    `json:"type" gorm:"size:20;not null;default:'script'"` // 任务类型:script(脚本), http(远程调用)
	Script      string    `json:"script" gorm:"type:text"`                       // 脚本内容
	URL         string    `json:"url" gorm:"size:255"`                           // HTTP URL
	Method      string    `json:"method" gorm:"size:10;default:'GET'"`           // HTTP 方法
	Headers     string    `json:"headers" gorm:"type:text"`                      // HTTP 请求头
	Body        string    `json:"body" gorm:"type:text"`                         // HTTP 请求体
	Timeout     int       `json:"timeout" gorm:"default:300"`                    // 超时时间(秒)
	Status      string    `json:"status" gorm:"size:20;default:'active'"`        // 状态:active, inactive
	EnableCron  uint8     `json:"enable_cron" gorm:"type:tinyint;default:0"`     // 是否启用定时执行:0-否,1-是
	CronExpr    string    `json:"cron_expr"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

Task 任务表

type TaskLog

type TaskLog struct {
	ID        uint      `json:"id" gorm:"primaryKey"`
	TaskID    uint      `json:"task_id" gorm:"index"`                    // 任务ID
	Task      Task      `json:"task" gorm:"foreignKey:TaskID"`           // 任务关联
	Status    string    `json:"status" gorm:"size:20;default:'pending'"` // 执行状态:success, failed, running
	Output    string    `json:"output" gorm:"type:text"`                 // 执行输出
	Error     string    `json:"error" gorm:"type:text"`                  // 错误信息
	StartTime time.Time `json:"start_time"`                              // 开始时间
	EndTime   time.Time `json:"end_time"`                                // 结束时间
	Duration  int       `json:"duration"`                                // 执行时长(秒)
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

TaskLog 任务执行日志表

type User

type User struct {
	ID            uint      `json:"id" gorm:"primaryKey"`
	Username      string    `json:"username" gorm:"uniqueIndex;size:50"`
	Password      string    `json:"-" gorm:"size:100"` // 密码不返回给前端
	Nickname      string    `json:"nickname" gorm:"size:50"`
	RoleID        uint      `json:"role_id"`
	Role          Role      `json:"role" gorm:"foreignKey:RoleID"`
	Status        int       `json:"status" gorm:"default:1"` // 1:启用 0:禁用
	LastLogin     time.Time `json:"last_login"`
	HasChangedPwd bool      `json:"has_changed_pwd" gorm:"default:false"` // 是否已修改初始密码
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

User 用户表

Jump to

Keyboard shortcuts

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