Files
bl/modules/config/model/map.go

49 lines
1.6 KiB
Go
Raw Normal View History

2026-02-20 21:34:27 +08:00
package model
import (
"blazing/cool"
)
// 表名常量定义:地图配置表
const (
TableNameMapConfig = "config_map" // 地图配置表记录地图ID、刷野怪开关、天气开关、掉落物配置等核心信息
)
// MapConfig 地图核心配置模型(包含地图基础属性、刷怪配置、天气配置、掉落物配置)
type MapConfig struct {
2026-02-20 22:39:04 +08:00
*cool.Model // 保留通用ModelID/创建时间/更新时间等)
2026-02-20 21:34:27 +08:00
// 核心字段
MapID uint32 `gorm:"not null;primaryKey;comment:'地图唯一ID主键'" json:"map_id" description:"地图ID"`
WeatherType []uint32 `gorm:"type:int[];comment:'天气类型( 0 晴天,1-雨天2-雪天)'" json:"weather_type"`
//是否超时空
IsTimeSpace int `gorm:"type:int;default:0;comment:'是否超时空'" json:"is_time_space"`
2026-04-15 00:07:36 +08:00
// 是否等级突破地图
IsLevelBreakMap int `gorm:"type:int;default:0;comment:'是否等级突破地图'" json:"is_level_break_map"`
2026-02-20 21:34:27 +08:00
// 掉落物配置
DropItemIds []uint32 `gorm:"type:int[];comment:'掉落物IDs" json:"drop_item_ids"`
Remark string `gorm:"type:varchar(255);default:'';comment:'性别配置备注(如:默认性别规则)'" json:"remark"` // 调整注释
2026-02-20 21:34:27 +08:00
}
// -------------------------- 核心配套方法(遵循项目规范)--------------------------
func (*MapConfig) TableName() string {
return TableNameMapConfig
}
func (*MapConfig) GroupName() string {
return "default"
}
func NewMapConfig() *MapConfig {
return &MapConfig{
2026-02-20 22:39:04 +08:00
Model: cool.NewModel(),
2026-02-20 21:34:27 +08:00
}
}
// -------------------------- 表结构自动同步 --------------------------
func init() {
cool.CreateTable(&MapConfig{})
}