Add classification annotations

This commit is contained in:
2025-10-27 23:12:15 +08:00
parent 3990ec01c6
commit 5aacb88c22
44 changed files with 2769 additions and 2241 deletions

View File

@@ -10,15 +10,13 @@ import (
"gorm.io/gorm"
)
// ============================================================================
// 结构体定义
// ============================================================================
// App 应用表模型
// 用于管理应用程序的基本信息
// UUID 为应用的唯一标识符,自动生成
// Status 为应用状态1:启用 0:禁用默认为1
// Name 为应用名称
// Secret 为应用密钥用于API认证
// Version 为应用版本号
// CreatedAt/UpdatedAt 由 GORM 自动维护
type App struct {
// ID主键自增同时通过 json 标签保证前端接收为 id
ID uint `gorm:"primaryKey;comment:应用ID自增主键" json:"id"`
@@ -107,6 +105,10 @@ type App struct {
UpdatedAt time.Time `gorm:"comment:更新时间" json:"updated_at"`
}
// ============================================================================
// 结构体方法
// ============================================================================
// BeforeCreate 在创建记录前自动生成UUID和密钥
func (app *App) BeforeCreate(tx *gorm.DB) error {
if app.UUID == "" {