Files
bl/modules/config/model/user_talk.go
昔念 d55c96e383
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
```
feat(database): 添加多个玩家相关表的联合唯一约束

- 为player_talk表添加玩家+挖矿联合唯一索引
- 为player_task表添加玩家+任务联合唯一索引
- 为player_title表添加玩家+称号联合唯一索引
- 为player_pet表添加玩家+精灵联合唯一索引
- 为player_cdk_log表添加玩家+CDK联合唯一索引
- 为player_egg表添加玩家孵蛋联合唯一索引
- 为player_pvp表添加PVP索引
- 为player_sign_in_log表添加签到联合唯一索引
- 为player_room_house表添加房间索引

fix(user-talk): 修复获取聊天配置
2026-03-28 02:22:15 +08:00

53 lines
2.2 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" // 沿用你项目中已有的基础Model包
)
// 表名常量(遵循项目现有命名规范)
const TableNameMineralCollectionConfig = "config_talk"
// MineralCollectionConfig 挖矿/采集/采摘矿产配置表Model定义
// 字段完全匹配数据表结构,包含最小/最大产出核心字段
type MineralCollectionConfig struct {
*BaseConfig
// MapID 矿产所在地图ID
MapID uint32 `gorm:"column:map_id;not null;index:idx_mineral_collection_config_map_id;comment:矿产所在地图ID" json:"map_id"`
//uint32 `gorm:"not null;default:0;comment:'限购类型( 0-每日限购 1-每周限购 2-每月限购)'" json:"quota_type" description:"限购类型"`
Limit uint32 `gorm:"column:limit;default:0;comment:限制数量" json:"limit"`
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
ItemIDS []uint32 `gorm:"column:item_ids;type:jsonb;index:idx_mineral_collection_config_item_id;comment:物品编号对应道具系统ID" json:"item_ids"`
}
// TableName 指定数据表名(必须匹配数据库表名,遵循项目规范)
func (*MineralCollectionConfig) TableName() string {
return TableNameMineralCollectionConfig
}
// GroupName 指定表分组(与项目现有表保持一致,默认分组)
func (*MineralCollectionConfig) GroupName() string {
return "default"
}
// NewMineralCollectionConfig 创建挖矿配置表实例初始化基础Model
// 保证通用字段createTime/updateTime被正确初始化
func NewMineralCollectionConfig() *MineralCollectionConfig {
return &MineralCollectionConfig{
BaseConfig: NewBaseConfig(),
}
}
// init 程序启动时自动创建数据表(与项目现有表初始化逻辑一致)
// 若项目有统一的表初始化入口,可将此逻辑迁移至对应位置
func init() {
// 自动创建表(不存在则创建,已存在则不操作)
cool.CreateTable(&MineralCollectionConfig{})
}