game/common/model/user/userResources.go
2025-06-16 00:50:42 +08:00

42 lines
1.4 KiB
Go
Raw 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 user
// 玩家账户表
type UserResources struct {
UID int64 `gorm:"uniqueIndex" json:"uid"`
Gold int64 `gorm:"default:0" json:"gold"` // 金币
Diamond int64 `gorm:"default:0" json:"diamond"` // 钻石
}
func (u UserResources) GetId() int64 {
return u.UID
}
func (u UserResources) TableName() string {
return "user_resources"
}
type UserResourcesLog struct {
UID int64 `gorm:"uniqueIndex" json:"uid"`
ResName string `gorm:"default:0" json:"res_name"` // 资源名
ResAddValue int64 `gorm:"default:0" json:"res_value"` // 资源增加值
ResAfterValue int64 `gorm:"default:0" json:"res_after_value"` // 资源增加后的值
GameId int `gorm:"default:0" json:"game_id"` // 添加资源的玩法id充值等非玩法操作资源则为0
GameNo string `json:"game_no"` // 游戏局id同上
Reason string `json:"reason"` // 原因
}
func (u UserResourcesLog) GetId() int64 {
return 0
}
func (u UserResourcesLog) TableName() string {
return "user_resources_log"
}
type AddUserRes struct {
GameId int `json:"game_id"` // 添加资源的玩法id充值等非玩法操作资源则为0
GameNo string `json:"game_no"` // 游戏局id同上
Reason string `json:"reason"` // 原因
AddRes map[string]int64 `json:"add_res"` // map[资源名]增加值
}