Files
bl/modules/player/model/egg.go
昔念 2860bcfa5c
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
1
2026-02-09 01:29:33 +08:00

78 lines
2.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 model
import (
"blazing/cool"
)
// 表名常量
const TableNamePlayerEgg = "player_egg"
// Egg 对应数据库表 player_cdk_log用于记录CDK兑换日志
type Egg struct {
Base
PlayerID uint64 `gorm:"not null;index:idx_player_Egg_by_player_id;comment:'所属玩家ID'" json:"player_id"`
Data S2C_GET_BREED_INFO `gorm:"type:jsonb;not null;comment:'全部数据'" json:"data"`
CurEgg EggInfo `gorm:"type:jsonb;not null;comment:'当前蛋'" json:"cur_egg"`
EggList []EggInfo `gorm:"type:jsonb;not null;comment:'蛋列表'" json:"egg_list"`
}
// S2C_GET_BREED_INFO 获取繁殖信息协议
// 后端到前端
type S2C_GET_BREED_INFO struct {
// BreedState 繁殖状态
BreedState uint32 `json:"breedState"`
StartTime uint32 `struc:"skip"` //返回记录
// BreedLeftTime 繁殖剩余时间
BreedLeftTime uint32 `json:"breedLeftTime"`
// BreedCoolTime 繁殖冷却时间
BreedCoolTime uint32 `json:"breedCoolTime"`
// MalePetCatchTime 雄性精灵捕捉时间
MalePetCatchTime uint32 `json:"malePetCatchTime"`
// MalePetID 雄性精灵ID
MalePetID uint32 `json:"malePetID"`
// FeMalePetCatchTime 雌性精灵捕捉时间
FeMalePetCatchTime uint32 `json:"feMalePetCatchTime"`
// FeMalePetID 雌性精灵ID
FeMalePetID uint32 `json:"feMalePetID"`
// HatchState 孵化状态 ,0=未孵化 1=孵化中 2=已孵化
HatchState uint32 `json:"hatchState"`
// HatchLeftTime 孵化剩余时间
HatchLeftTime uint32 `json:"hatchLeftTime"`
// EggID 当前孵化的精灵蛋ID
EggID uint32 `json:"eggID"`
// Intimacy 亲密度 1 = 悲伤 以此类推 ["悲伤","冷淡","平淡","友好","亲密无间"]
Intimacy uint32 `json:"intimacy"`
}
// EggInfo 精灵蛋信息
type EggInfo struct {
OwnerID uint32 `json:"ownerID"` // 所属人ID
EggCatchTime uint32 `json:"eggCatchTime"` // 精灵蛋获得时间
EggID uint32 `json:"eggID"` // 精灵蛋ID
MalePetID uint32 `json:"male"` // 雄性精灵ID
FeMalePetID uint32 `json:"female"` // 雌性精灵ID
//ShinyCode uint32 `struc:"skip"` //返回记录
}
// TableName 返回表名
func (*Egg) TableName() string {
return TableNamePlayerEgg
}
// GroupName 返回表组名
func (*Egg) GroupName() string {
return "default"
}
// NewEgg 创建一个新的CDK记录
func NewEgg() *Egg {
return &Egg{
Base: *NewBase(),
}
}
// init 程序启动时自动创建表
func init() {
cool.CreateTable(&Egg{})
}