build(go): 升级 gf/v2 框架至 v2.7.0 统一将 common、login 和 mysql driver 中的 github.com/gogf/gf/v2 依赖版本从 v2.6.3 更新到 v2.7.0。 feat(logic): 优化道具服务逻辑与数据结构 - 修改 Item 结构体,去除 Data 字段,新增 ItemId 和 ItemCnt 字段以提高可读性和查询效率。 - 调整 Item 相关方法实现,包括 Item(), AddItem(), SubItem() 和 CheakItem() 方法,支持直接按范围获取及增减物品
51 lines
1.1 KiB
Go
51 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"`
|
||
// 物品Id,
|
||
ItemId uint32 `json:"item_id"`
|
||
// 物品数量,
|
||
ItemCnt uint32 `json:"item_cnt"`
|
||
}
|
||
|
||
type SingleItemInfo struct {
|
||
// 物品Id,
|
||
ItemId uint32 `json:"itemId"`
|
||
// 物品数量,
|
||
ItemCnt uint32 `json:"itemCnt"`
|
||
// 固定值360000,
|
||
LeftTime uint32 `json:"leftTime"`
|
||
// 固定值0,
|
||
ItemLevel uint32 `json:"itemLevel"`
|
||
}
|
||
|
||
// TableName PlayerBagItem's table name
|
||
func (*Item) TableName() string {
|
||
return TableNamePlayerBagItem
|
||
}
|
||
|
||
// GroupName PlayerBagItem's table group
|
||
func (*Item) GroupName() string {
|
||
return "default"
|
||
}
|
||
|
||
// NewPlayerBagItem create a new PlayerBagItem
|
||
func NewPlayerBag() *Item {
|
||
return &Item{
|
||
Model: cool.NewModel(),
|
||
}
|
||
}
|
||
|
||
// init 创建表
|
||
func init() {
|
||
cool.CreateTable(&Item{})
|
||
}
|