game/common/model/user/logGameRecord.go

44 lines
1.8 KiB
Go
Raw Normal View History

2025-06-21 00:58:22 +08:00
package user
import (
"gorm.io/datatypes"
"time"
)
type UserLog struct {
ID int64 `json:"id"`
Nickname string `json:"nickname"` // 昵称
AvatarUrl string `json:"avatar_url"` // 头像
AvatarFrame string `json:"avatar_frame"` // 头像框
Gold int32 `json:"gold"` // 金币
}
type GameRecordLog struct {
GameNo string `gorm:"primaryKey;type:String" json:"game_no"`
GameId int32 `gorm:"type:Int32;default:0" json:"game_id"`
RoomId int32 `gorm:"type:Int32;default:0" json:"room_id"`
RoomType int32 `gorm:"type:Int32;default:0" json:"room_type"`
StartTime time.Time `gorm:"type:DateTime;default:now()" json:"start_time"` // 开始时间
EndTime time.Time `gorm:"type:DateTime;default:now()" json:"end_time"` // 结束时间
Users datatypes.JSONType[[]UserLog] `json:"users"`
UserTotalBet int64 `gorm:"type:Int64;default:0" json:"user_total_bet"` // 所有玩家总投注额
UserTotalNetWin int64 `gorm:"type:Int64;default:0" json:"user_total_net_win"` // 所有玩家总净胜分
TotalTax int64 `gorm:"type:Int64;default:0" json:"total_tax"` // 税
GameData string `gorm:"type:String" json:"game_data"` // 游戏数据(JSON格式)
}
func (u GameRecordLog) GetId() int64 {
return 0
}
func (u GameRecordLog) TableName() string {
return "game_record_log"
}
func (u GameRecordLog) TableOptions() string {
return `ENGINE=MergeTree()
ORDER BY (game_no, game_id, room_type)
PARTITION BY toYYYYMM(start_time)
`
}