`
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-02-07 20:09:02 +08:00
parent cdfbc45887
commit 1a0a2badd4
3 changed files with 14 additions and 13 deletions

View File

@@ -15,12 +15,9 @@ type Player struct {
*cool.Model
PlayerID uint64 `gorm:"not null;index:idx_pet_by_player_id;comment:'所属玩家ID'" json:"player_id"`
LastResetTime *gtime.Time `struc:"skip" json:"last_reset_time"` // 重置时间,比如电池和每日任务
Data string `gorm:"type:jsonb;not null;comment:'全部数据'" json:"data"`
}
type PlayerEX struct {
Player
Data PlayerInfo `orm:"data" json:"data"`
Data PlayerInfo `gorm:"type:jsonb;not null;comment:'全部数据'" json:"data"`
}
type Pos struct {
X uint32 `struc:"uint32" default:"0"`
Y uint32 `struc:"uint32" default:"0"`
@@ -227,11 +224,9 @@ func (*Player) GroupName() string {
}
// NewPlayerInfo create a new PlayerInfo
func NewPlayer() *PlayerEX {
return &PlayerEX{
Player: Player{
Model: cool.NewModel(),
},
func NewPlayer() *Player {
return &Player{
Model: cool.NewModel(),
}
}

View File

@@ -52,7 +52,7 @@ func (s *InfoService) Reg(nick string, color uint32) *model.PlayerInfo {
return &t.Data
}
func (s *InfoService) Person(userid uint32) (out *model.PlayerEX) {
func (s *InfoService) Person(userid uint32) (out *model.Player) {
cool.DBM(s.Model).Where("player_id", userid).Scan(&out)
@@ -73,7 +73,7 @@ func (s *InfoService) GetCache() *model.PlayerInfo {
func (s *InfoService) SetLogin() *model.PlayerInfo {
m := cool.DBM(s.Model).Where("player_id", s.userid)
var tt *model.PlayerEX
var tt *model.Player
m.Scan(&tt)
if tt == nil {
return nil
@@ -190,7 +190,7 @@ func (s *InfoService) Save(data model.PlayerInfo) {
return
}
m := s.PModel(s.Model)
var tt *model.PlayerEX
var tt *model.Player
m.Scan(&tt)
if tt == nil {
return