Files
bl/modules/blazing/model/item.go
昔念 3668f3c5b9 feat(pet): 新增宠物功能和相关数据结构
- 新增宠物配置和自然属性配置的 XML 解析
- 实现宠物信息生成和属性计算逻辑
- 添加宠物数据库模型和相关服务
- 更新登录和任务完成逻辑,支持宠物相关操作
2025-08-31 00:27:07 +08:00

43 lines
1.1 KiB
Go

package model
import (
"blazing/cool"
)
const TableNamePlayerBagItem = "player_bag_item"
// PlayerBagItem mapped from table <player_bag_item>
type Item struct {
*cool.Model
PlayerID uint64 `gorm:"not null;index:idx_player_bag_item_by_player_id;comment:'所属玩家ID'" json:"player_id"`
Data string `gorm:"type:text;not null;comment:'全部数据'" json:"data"`
}
type ItemE struct {
ID int32 `gorm:"not null;comment:'道具唯一编号'" json:"item_id"`
Count int32 `gorm:"not null;default:0;comment:'拥有数量 '" json:"count"`
Max int32 `gorm:"not null;default:0;comment:'最大数量 '" json:"max"`
Total int32 `gorm:"not null;default:0;comment:'使用次数'" json:"total"`
}
// TableName PlayerBagItem's table name
func (*ItemE) TableName() string {
return TableNamePlayerBagItem
}
// GroupName PlayerBagItem's table group
func (*ItemE) GroupName() string {
return "default"
}
// NewPlayerBagItem create a new PlayerBagItem
func NewPlayerBag() *Item {
return &Item{
Model: cool.NewModel(),
}
}
// init 创建表
func init() {
cool.CreateTable(&Item{})
}