905086
2026-11-09 cbb26873e88a7a13e868448c1cc578ce70b8c6ae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
package models
 
import "time"
 
type Admin struct {
    ID        uint      `gorm:"primaryKey" json:"id"`
    Username  string    `gorm:"uniqueIndex;size:50" json:"username"`
    Password  string    `json:"-"`
    CreatedAt time.Time `json:"created_at"`
}
 
type User struct {
    ID        uint      `gorm:"primaryKey" json:"id"`
    Phone     string    `gorm:"uniqueIndex;size:20" json:"phone"`
    Password  string    `json:"-"`
    CreatedAt time.Time `json:"created_at"`
}
 
type Category struct {
    ID        uint      `gorm:"primaryKey" json:"id"`
    Name      string    `gorm:"uniqueIndex;size:50" json:"name"`
    Sort      int       `json:"sort"`
    CreatedAt time.Time `json:"created_at"`
}
 
type Game struct {
    ID           uint      `gorm:"primaryKey" json:"id"`
    Title        string    `gorm:"size:255" json:"title"`
    CategoryID   uint      `json:"category_id"`
    CategoryName string    `gorm:"-" json:"category_name,omitempty"`
    Platform     string    `gorm:"size:20;default:pc" json:"platform"` // pc / switch
    Tags         string    `gorm:"size:200" json:"tags"`               // 逗号分隔: 即时战略,经典怀旧
    Size         string    `gorm:"size:20" json:"size"`                // 游戏大小 232.6 GB
    InstallSize  string    `gorm:"size:20" json:"install_size"`        // 安装磁盘占用 411.6 GB
    OSReq        string    `gorm:"size:100" json:"os_req"`
    CPUReq       string    `gorm:"size:100" json:"cpu_req"`
    GPUReq       string    `gorm:"size:100" json:"gpu_req"`
    RAMReq       string    `gorm:"size:100" json:"ram_req"`
    VersionNote  string    `gorm:"size:500" json:"version_note"` // V1.685.421顶级版|容量175GB|官方简体中文...
    LaunchExe    string    `gorm:"size:255" json:"launch_exe"`   // 游戏启动程序相对路径(相对游戏安装目录),如 Binaries\Win64\Game.exe
    Cover        string    `gorm:"size:255" json:"cover"`
    Video        string    `gorm:"size:255" json:"video"`
    Screenshots  string    `gorm:"type:text" json:"screenshots"` // JSON数组
    Description  string    `gorm:"type:longtext" json:"description"`
    Files        string    `gorm:"type:text" json:"files"` // JSON数组 [{name,size,url}]
    IsBanner     bool      `json:"is_banner"`              // 是否在首页轮播
    DownloadCount int      `json:"download_count"`
    UpdatedAt    time.Time `json:"updated_at"`
    CreatedAt    time.Time `json:"created_at"`
}
 
type Tool struct {
    ID          uint      `gorm:"primaryKey" json:"id"`
    Name        string    `gorm:"size:100" json:"name"`
    Size        string    `gorm:"size:20" json:"size"` // 展示用大小,如 85.2MB
    Cover       string    `gorm:"size:255" json:"cover"`
    Description string    `gorm:"size:500" json:"description"`
    FileURL     string    `gorm:"size:255" json:"file_url"`    // 下载压缩包URL
    LaunchExe   string    `gorm:"size:255" json:"launch_exe"` // 启动程序相对路径(相对解压后目录)
    CreatedAt   time.Time `json:"created_at"`
}
 
type MemberKey struct {
    ID          uint       `gorm:"primaryKey" json:"id"`
    Code        string     `gorm:"uniqueIndex;size:50" json:"code"`
    CardType    string     `gorm:"size:20" json:"card_type"` // day/month/year/forever
    Status      int        `json:"status"`                   // 0未使用 1已使用
    Frozen      bool       `gorm:"default:false" json:"frozen"` // 是否冻结(冻结后不可使用)
    UserID      uint       `json:"user_id"`
    MachineCode string     `gorm:"size:100" json:"machine_code"`
    ActivatedAt *time.Time `json:"activated_at"`
    ExpiredAt   *time.Time `json:"expired_at"` // nil 表示永久
    ResetCount  int        `json:"reset_count"`
    CreatedAt   time.Time  `json:"created_at"`
}
 
func (k MemberKey) CardName() string {
    switch k.CardType {
    case "day":
        return "日卡"
    case "month":
        return "月卡"
    case "year":
        return "年卡"
    case "forever":
        return "永久卡"
    }
    return k.CardType
}
 
type Favorite struct {
    ID        uint      `gorm:"primaryKey" json:"id"`
    UserID    uint      `gorm:"uniqueIndex:idx_fav" json:"user_id"`
    GameID    uint      `gorm:"uniqueIndex:idx_fav" json:"game_id"`
    CreatedAt time.Time `json:"created_at"`
}
 
type LibraryItem struct {
    ID        uint      `gorm:"primaryKey" json:"id"`
    UserID    uint      `gorm:"uniqueIndex:idx_lib" json:"user_id"`
    GameID    uint      `gorm:"uniqueIndex:idx_lib" json:"game_id"`
    CreatedAt time.Time `json:"created_at"`
}
 
type Announcement struct {
    ID        uint      `gorm:"primaryKey" json:"id"`
    Content   string    `gorm:"type:text" json:"content"`
    CreatedAt time.Time `json:"created_at"`
}
 
// PasswordResetRequest 用户找回密码申请(客户端提交,管理员在后台同意并重置)
type PasswordResetRequest struct {
    ID         uint       `gorm:"primaryKey" json:"id"`
    Phone      string     `gorm:"size:20;index" json:"phone"`
    ProposedPwd string     `gorm:"size:20" json:"proposed_password"` // 用户期望的新密码(管理员同意后默认采用)
    Status     int        `gorm:"default:0" json:"status"` // 0待处理 1已同意
    NewPwd     string     `gorm:"size:20" json:"new_password"` // 同意时实际设置的新密码(明文,便于管理员告知用户)
    HandledAt  *time.Time `json:"handled_at"`
    CreatedAt  time.Time  `json:"created_at"`
}
 
// ClientVersion 客户端版本(管理后台上传,下载页展示最新版供用户下载)
type ClientVersion struct {
    ID            uint      `gorm:"primaryKey" json:"id"`
    Version       string    `gorm:"size:50" json:"version"`   // 版本号,如 1.0.0
    Notes         string    `gorm:"size:1000" json:"notes"`   // 更新说明
    FileURL       string    `gorm:"size:255" json:"file_url"` // 安装包URL(zip)
    FileSize      string    `gorm:"size:20" json:"file_size"` // 展示大小,如 30.6 MB
    DownloadCount int       `json:"download_count"`
    CreatedAt     time.Time `json:"created_at"`
}