All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor(common/utils): 重构concurrent_swiss_map使用官方sync.Map实现 - 替换原有的第三方并发map实现,改为基于标准库sync.Map的封装 - 保持完全的API兼容性,原有配置方法变为无实际作用的占位符 - 优化Range方法实现,移除goroutine/channel开销,避免潜在的死锁风险 - 移除依赖的外部库和
49 lines
1.5 KiB
Go
49 lines
1.5 KiB
Go
package model
|
||
|
||
import (
|
||
"blazing/cool"
|
||
)
|
||
|
||
const (
|
||
TableNameBossConfig = "config_boss" // BOSS配置表(全量包含基础/奖励/护盾/捕捉/特效/世界野怪/地图费用/战斗通用逻辑)
|
||
)
|
||
|
||
// BossConfig BOSS配置模型(覆盖所有补充的配置项:GBTL/非VIP费用/首场景/战斗通用逻辑)
|
||
type BossConfig struct {
|
||
*cool.Model // 嵌入通用Model(包含ID/创建时间/更新时间等通用字段)
|
||
PetBaseConfig
|
||
|
||
MapID int32 `gorm:"not null;index;comment:'所属地图ID'" json:"map_id" description:"地图ID"`
|
||
|
||
Ordernum int32 `gorm:"not null;comment:'排序'" json:"ordernum" description:"排序"`
|
||
ParentID int32 `gorm:"column:parentId;type:int" json:"parentId"` // 父ID
|
||
Remark string `gorm:"comment:'BOSS备注'" json:"remark"`
|
||
//是否可捕捉MapPit
|
||
IsCapture int `gorm:"type:int;default:0;comment:'是否可捕捉'" json:"is_capture"`
|
||
Script string `gorm:"size:1024;default:'';comment:'BOSS脚本'" json:"script"` //boss出招逻辑做成js脚本
|
||
|
||
}
|
||
|
||
// TableName 指定BossConfig对应的数据库表名
|
||
func (*BossConfig) TableName() string {
|
||
return TableNameBossConfig
|
||
}
|
||
|
||
// GroupName 指定表所属的分组(保持和怪物刷新表一致)
|
||
func (*BossConfig) GroupName() string {
|
||
return "default"
|
||
}
|
||
|
||
// NewBossConfig 创建一个新的BossConfig实例(初始化通用Model字段+所有默认值)
|
||
|
||
func NewBossConfig() *BossConfig {
|
||
return &BossConfig{
|
||
Model: cool.NewModel(),
|
||
}
|
||
}
|
||
|
||
// init 程序启动时自动创建/同步boss_config表结构
|
||
func init() {
|
||
cool.CreateTable(&BossConfig{})
|
||
}
|