Files
bl/modules/config/model/monster_refresh.go
昔念 e5c75f7359
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
1
2026-02-13 22:57:05 +08:00

53 lines
1.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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"`
MonsterID string `gorm:"not null;comment:'精灵ID,填0为填充数组'" json:"monster_id"`
MinLevel int32 `gorm:"not null;comment:'精灵最低等级'" json:"min_level"`
MaxLevel int32 `gorm:"not null;comment:'精灵最高等级'" json:"max_level"`
FixPos int32 `gorm:"not null;comment:'固定位置刷新0:随机位置,没有固定位置的时候就会取一个随机位置,如果没有随机位置就不刷新1-9:固定位置)'" json:"fix_pos"`
Script string `gorm:"type:text;not null;comment:'刷新脚本JS格式对应前端编辑器配置'" json:"value"`
// 以下为原模型保留的异色相关字段(前端暂未配置,如需移除可删除)
ShinyID string `gorm:"not null;comment:'异色唯一标识ID'" json:"shiny_id"`
}
type MonsterRefreshEX struct {
MonsterRefresh
MonsterID []uint32 `json:"monster_id"`
ShinyID []uint32 `json:"shiny_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{})
}