refactor: 重构怪物刷新和地图节点配置模型
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
将怪物刷新配置拆分为独立的 map_monster 和 map_moster_node 模型 新增 mapnode 模型用于管理地图节点配置 优化坑位绑定和刷新规则的数据结构
This commit is contained in:
46
modules/config/model/map_moster_node.go
Normal file
46
modules/config/model/map_moster_node.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
)
|
||||
|
||||
const (
|
||||
TableNameMapPit = "config_map_pit" // 地图坑位配置表(记录坑位归属、类型、属性、关联刷新规则等)
|
||||
)
|
||||
|
||||
// MapPit 地图坑位核心配置模型(参照MonsterRefresh实现风格)
|
||||
type MapPit struct {
|
||||
*BaseConfig // 复用通用基础配置(ID/创建时间/更新时间等)
|
||||
|
||||
PitName string `gorm:"type:varchar(100);default:'';comment:'坑位名称'" json:"pit_name"`
|
||||
|
||||
RefreshID []int `gorm:"type:int[];comment:'关联刷新规则ID列表'" json:"refresh_id"`
|
||||
//最小等级
|
||||
MinLevel int `gorm:"type:int;default:0;comment:'最小等级'" json:"min_level"`
|
||||
//最大等级
|
||||
MaxLevel int `gorm:"type:int;default:0;comment:'最大等级'" json:"max_level"`
|
||||
|
||||
Script string `gorm:"type:text;not null;comment:'刷新脚本(JS格式,对应前端编辑器配置)'" json:"value"`
|
||||
}
|
||||
|
||||
// TableName 指定MapPit对应的数据库表名(遵循原模型规范)
|
||||
func (*MapPit) TableName() string {
|
||||
return TableNameMapPit
|
||||
}
|
||||
|
||||
// GroupName 指定表所属的分组(保持和原模型一致)
|
||||
func (*MapPit) GroupName() string {
|
||||
return "default"
|
||||
}
|
||||
|
||||
// NewMapPit 创建一个新的MapPit实例(初始化通用BaseConfig)
|
||||
func NewMapPit() *MapPit {
|
||||
return &MapPit{
|
||||
BaseConfig: NewBaseConfig(),
|
||||
}
|
||||
}
|
||||
|
||||
// init 初始化表结构(程序启动时自动创建/同步表)
|
||||
func init() {
|
||||
cool.CreateTable(&MapPit{})
|
||||
}
|
||||
Reference in New Issue
Block a user