Files
nl-game-api/internal/model/save.go
2026-08-14 13:17:03 +08:00

18 lines
1.1 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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" }