2025-12-08 17:03:43 +08:00
|
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"blazing/cool" // 沿用你项目中已有的基础Model包
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// 表名常量(遵循项目现有命名规范)
|
2026-01-19 18:51:56 +08:00
|
|
|
|
const TableNameMineralCollectionConfig = "config_talk"
|
2025-12-08 17:03:43 +08:00
|
|
|
|
|
|
|
|
|
|
// MineralCollectionConfig 挖矿/采集/采摘矿产配置表Model定义
|
|
|
|
|
|
// 字段完全匹配数据表结构,包含最小/最大产出核心字段
|
|
|
|
|
|
type MineralCollectionConfig struct {
|
|
|
|
|
|
*cool.Model // 嵌入基础Model,包含id(主键)、createTime、updateTime等通用字段
|
|
|
|
|
|
|
|
|
|
|
|
// MapID 矿产所在地图ID
|
|
|
|
|
|
MapID uint32 `gorm:"column:map_id;not null;index:idx_mineral_collection_config_map_id;comment:矿产所在地图ID" json:"map_id"`
|
|
|
|
|
|
Type uint32 `gorm:"column:type;not null;index:idx_mineral_collection_config_type;comment:类型" json:"type"`
|
|
|
|
|
|
|
|
|
|
|
|
// DailyCollectCount 每日可采集次数
|
|
|
|
|
|
DailyCollectCount uint32 `gorm:"column:daily_collect_count;not null;comment:每日可采集次数" json:"daily_collect_count"`
|
|
|
|
|
|
|
|
|
|
|
|
// ItemID 物品编号(对应道具系统ID)
|
2025-12-25 20:49:54 +08:00
|
|
|
|
ItemIDS []uint32 `gorm:"column:item_ids;type:jsonb;index:idx_mineral_collection_config_item_id;comment:物品编号(对应道具系统ID)" json:"item_ids"`
|
2025-12-08 17:03:43 +08:00
|
|
|
|
// ItemMinCount 单次采集最小产出数量
|
2025-12-22 19:04:16 +08:00
|
|
|
|
// ItemMinCount uint32 `gorm:"column:item_min_count;not null;comment:单次采集最小产出数量" json:"item_min_count"`
|
|
|
|
|
|
// // ItemMaxCount 单次采集最大产出数量
|
|
|
|
|
|
// ItemMaxCount uint32 `gorm:"column:item_max_count;not null;comment:单次采集最大产出数量" json:"item_max_count"`
|
2025-12-08 17:03:43 +08:00
|
|
|
|
// Description 矿产描述
|
2025-12-22 19:04:16 +08:00
|
|
|
|
Description string `gorm:"column:description;type:varchar(128); comment:矿产描述" json:"description"`
|
|
|
|
|
|
// ItemGift []*ItemGift `gorm:"-" orm:"with:item_id=id"`
|
2025-12-08 17:03:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TableName 指定数据表名(必须匹配数据库表名,遵循项目规范)
|
|
|
|
|
|
func (*MineralCollectionConfig) TableName() string {
|
|
|
|
|
|
return TableNameMineralCollectionConfig
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GroupName 指定表分组(与项目现有表保持一致,默认分组)
|
|
|
|
|
|
func (*MineralCollectionConfig) GroupName() string {
|
|
|
|
|
|
return "default"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// NewMineralCollectionConfig 创建挖矿配置表实例(初始化基础Model)
|
|
|
|
|
|
// 保证通用字段(createTime/updateTime)被正确初始化
|
|
|
|
|
|
func NewMineralCollectionConfig() *MineralCollectionConfig {
|
|
|
|
|
|
return &MineralCollectionConfig{
|
|
|
|
|
|
Model: cool.NewModel(), // 调用基础Model的初始化方法
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// init 程序启动时自动创建数据表(与项目现有表初始化逻辑一致)
|
|
|
|
|
|
// 若项目有统一的表初始化入口,可将此逻辑迁移至对应位置
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
// 自动创建表(不存在则创建,已存在则不操作)
|
|
|
|
|
|
cool.CreateTable(&MineralCollectionConfig{})
|
|
|
|
|
|
}
|