All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor(config): 调整MapBoss结构体字段类型 - 将BossMonID字段从[]int切片类型改为int单值类型,并移除相关定义 - 将WinBonusID和FailBonusID字段从[]int切片类型改为int单值类型, 并设置默认值为0 - 移除多余的空行和格式调整,保持代码整洁
48 lines
1.6 KiB
Go
48 lines
1.6 KiB
Go
package model
|
||
|
||
import (
|
||
"blazing/cool"
|
||
)
|
||
|
||
const (
|
||
TableNameMapBoss = "config_map_boss" // 地图BOSS配置表(记录BOSS归属、属性、刷新规则、奖励等)
|
||
)
|
||
|
||
// MapBoss 地图BOSS核心配置模型(完全仿照MapPit实现风格)
|
||
type MapBoss struct {
|
||
*BaseConfig // 复用通用基础配置(ID/创建时间/更新时间/删除时间/备注等)
|
||
*Event // 嵌入BOSS事件配置
|
||
MapID int32 `gorm:"not null;index;comment:'所属地图ID'" json:"map_id" description:"地图ID"`
|
||
// BOSS唯一标识ID
|
||
BossID int `gorm:"not null;index;comment:'BOSSID'" json:"boss_id"`
|
||
BossName string `gorm:"type:varchar(100);default:'';comment:'BOSS名称'" json:"boss_name" description:"BOSS名称"`
|
||
|
||
WinBonusID int `gorm:"type:int;default:0;comment:'胜利奖励ID'" json:"win_bonus_id"`
|
||
FailBonusID int `gorm:"type:int;default:0;comment:'失败奖励ID'" json:"fail_bonus_id"`
|
||
//是否可捕捉MapPit
|
||
IsCapture int `gorm:"type:int;default:0;comment:'是否可捕捉'" json:"is_capture"`
|
||
}
|
||
|
||
// TableName 指定MapBoss对应的数据库表名(遵循原模型规范)
|
||
func (*MapBoss) TableName() string {
|
||
return TableNameMapBoss
|
||
}
|
||
|
||
// GroupName 指定表所属的分组(保持和MapPit一致)
|
||
func (*MapBoss) GroupName() string {
|
||
return "default"
|
||
}
|
||
|
||
// NewMapBoss 创建一个新的MapBoss实例(初始化通用BaseConfig和BossEvent)
|
||
func NewMapBoss() *MapBoss {
|
||
return &MapBoss{
|
||
BaseConfig: NewBaseConfig(),
|
||
Event: &Event{},
|
||
}
|
||
}
|
||
|
||
// init 初始化表结构(程序启动时自动创建/同步表)
|
||
func init() {
|
||
cool.CreateTable(&MapBoss{})
|
||
}
|