- 重构了登录控制器和登录服务,使用了cool框架的控制器和服务结构 - 移除了注册相关代码和不必要的示例代码 - 更新了登录服务,关联了服务器列表模型 - 删除了与示例相关的模型和服务文件
38 lines
998 B
Go
38 lines
998 B
Go
package model
|
|
|
|
import (
|
|
"blazing/cool"
|
|
)
|
|
|
|
const TableNamePlayerBattery = "player_battery"
|
|
|
|
// PlayerBattery mapped from table <player_battery>
|
|
type PlayerBattery struct {
|
|
*cool.Model
|
|
PlayerID uint64 `gorm:"not null;uniqueIndex:idx_player_battery_unique_by_player_id;comment:'所属玩家ID'" json:"player_id"`
|
|
RemainingTime int64 `gorm:"not null;default:0;comment:'剩余电池时间单位秒(uint32)'" json:"remaining_time"`
|
|
LastResetTime string `gorm:"comment:'上一次重置时间'" json:"last_reset_time"`
|
|
}
|
|
|
|
// TableName PlayerBattery's table name
|
|
func (*PlayerBattery) TableName() string {
|
|
return TableNamePlayerBattery
|
|
}
|
|
|
|
// GroupName PlayerBattery's table group
|
|
func (*PlayerBattery) GroupName() string {
|
|
return "default"
|
|
}
|
|
|
|
// NewPlayerBattery create a new PlayerBattery
|
|
func NewPlayerBattery() *PlayerBattery {
|
|
return &PlayerBattery{
|
|
Model: cool.NewModel(),
|
|
}
|
|
}
|
|
|
|
// init 创建表
|
|
func init() {
|
|
cool.CreateTable(&PlayerBattery{})
|
|
}
|