18 lines
1.1 KiB
Go
18 lines
1.1 KiB
Go
package model
|
||
|
||
// GameSave 游戏存档表:支持存档的单机游戏(如饥荒)一人一游戏一份快照
|
||
// 快照内容由前端游戏自行序列化(JSON 字符串),后端只负责存取
|
||
type GameSave struct {
|
||
ID int `gorm:"primaryKey" json:"id"` // 存档ID
|
||
UserID int `gorm:"uniqueIndex:uk_user_game" json:"user_id"` // 玩家用户ID
|
||
GameID int `gorm:"uniqueIndex:uk_user_game" json:"game_id"` // 游戏ID
|
||
Day int `gorm:"default:1" json:"day"` // 存档进度天数(列表/继续面板展示用)
|
||
Score int `gorm:"default:0" json:"score"` // 存档时分数(展示用)
|
||
Data string `gorm:"type:mediumtext" json:"data"` // 游戏状态快照(JSON 字符串,前端序列化)
|
||
CreatedAt int64 `gorm:"autoCreateTime" json:"created_at"` // 创建时间(int 时间戳)
|
||
UpdatedAt int64 `gorm:"autoUpdateTime" json:"updated_at"` // 更新时间(int 时间戳)
|
||
}
|
||
|
||
// TableName 指定表名
|
||
func (GameSave) TableName() string { return "game_saves" }
|