```
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

refactor(config): 移除怪物刷新相关代码并优化地图坑位配置

移除 modules/config/controller/admin/monster_refresh.go 中的
TaskInfoController 及其相关路由注册逻辑

移除 modules/config/model/map_monster.go 中的 MonsterRefresh
模型定义及相关常量、方法

重构 modules/config/model/map_pit.go 中的 MapPit 结
This commit is contained in:
昔念
2026-02-24 14:11:01 +08:00
parent 41714fca0b
commit 0a2ec3af08
4 changed files with 84 additions and 165 deletions

View File

@@ -1,56 +0,0 @@
package model
import (
"blazing/cool"
)
const (
TableNameMonsterRefresh = "config_monster_refresh" // 怪物刷新规则表(地图-精灵等级-刷新脚本配置)
)
// MonsterRefresh 怪物刷新规则模型(对应前端配置的地图/精灵/等级/脚本配置)
type MonsterRefresh struct {
*BaseConfig
MapID int32 `gorm:"not null;comment:'地图ID'" json:"map_id"`
PitID1 []int32 `gorm:"type:int[];not null;comment:'坑位1绑定的坑位ID列表多绑循环刷'" json:"pit_id_1"`
PitID2 []int32 `gorm:"type:int[];not null;comment:'坑位2绑定的坑位ID列表多绑循环刷'" json:"pit_id_2"`
PitID3 []int32 `gorm:"type:int[];not null;comment:'坑位3绑定的坑位ID列表多绑循环刷'" json:"pit_id_3"`
PitID4 []int32 `gorm:"type:int[];not null;comment:'坑位4绑定的坑位ID列表多绑循环刷'" json:"pit_id_4"`
PitID5 []int32 `gorm:"type:int[];not null;comment:'坑位5绑定的坑位ID列表多绑循环刷'" json:"pit_id_5"`
PitID6 []int32 `gorm:"type:int[];not null;comment:'坑位6绑定的坑位ID列表多绑循环刷'" json:"pit_id_6"`
PitID7 []int32 `gorm:"type:int[];not null;comment:'坑位7绑定的坑位ID列表多绑循环刷'" json:"pit_id_7"`
PitID8 []int32 `gorm:"type:int[];not null;comment:'坑位8绑定的坑位ID列表多绑循环刷'" json:"pit_id_8"`
PitID9 []int32 `gorm:"type:int[];not null;comment:'坑位9绑定的坑位ID列表多绑循环刷'" json:"pit_id_9"`
}
type MonsterRefreshEX struct {
MonsterRefresh
MonsterID []uint32 `json:"monster_id"`
ShinyID []uint32 `json:"shiny_id"`
// 扩展便于批量处理9个坑位
PitIDs [9][]uint32 `json:"pit_ids"` // 整合所有坑位ID前端/业务层批量处理用
}
// TableName 指定MonsterRefresh对应的数据库表名
func (*MonsterRefresh) TableName() string {
return TableNameMonsterRefresh
}
// GroupName 指定表所属的分组(保持和参考示例一致)
func (*MonsterRefresh) GroupName() string {
return "default"
}
// NewMonsterRefresh 创建一个新的MonsterRefresh实例初始化通用Model
func NewMonsterRefresh() *MonsterRefresh {
return &MonsterRefresh{
BaseConfig: NewBaseConfig(),
}
}
// init 初始化表结构(程序启动时自动创建/同步表)
func init() {
cool.CreateTable(&MonsterRefresh{})
}

View File

@@ -21,13 +21,13 @@ type Event struct {
// MapPit 地图坑位核心配置模型参照MonsterRefresh实现风格
type MapPit struct {
*cool.Model // 保留通用ModelID/创建时间/更新时间等)
Remark string `gorm:"type:varchar(255);default:'';comment:'性别配置备注(如:默认性别规则)'" json:"remark"` // 调整注释 // 复用通用基础配置ID/创建时间/更新时间等)
MapID []int32 `gorm:"type:int[];comment:'绑定地图地图ID'" json:"map_id"`
*BaseConfig
*Event
// 复用通用基础配置ID/创建时间/更新时间等)
MapID []int32 `gorm:"type:int[];comment:'绑定地图地图ID'" json:"map_id"`
RefreshID []int `gorm:"type:int[];comment:'精灵ID列表'" json:"refresh_id"`
Pos []int `gorm:"type:int[];comment:'坑位位置'" json:"pos"`
//最小等级
MinLevel int `gorm:"type:int;default:0;comment:'最小等级'" json:"min_level"`
//最大等级
@@ -49,8 +49,8 @@ func (*MapPit) GroupName() string {
// NewMapPit 创建一个新的MapPit实例初始化通用BaseConfig
func NewMapPit() *MapPit {
return &MapPit{
Model: cool.NewModel(),
Event: &Event{},
BaseConfig: NewBaseConfig(),
Event: &Event{},
}
}