package model import ( "database/sql/driver" "encoding/json" "github.com/shopspring/decimal" ) type BannedWords struct { Id int64 `gorm:"primary_key;column:id" json:"id"` // 违禁词ID` Word string `gorm:"column:word" json:"word"` // 违禁词内容` Category string `gorm:"column:category" json:"category"` // 违禁词分类` Description string `gorm:"column:description" json:"description"` // 违禁词描述(可选)` UserId int64 `gorm:"column:user_id" json:"userId"` // 用户ID,NULL 表示系统默认违禁词` CreateTime int64 `gorm:"column:create_time" json:"createTime"` // 创建时间戳` } func (BannedWords) TableName() string { return "banned_words" } type UserConfig struct { Id int64 `gorm:"primary_key;column:id" json:"id"` // 用户配置ID` Uid int64 `gorm:"column:uid" json:"uid"` // 用户ID,关联用户表` ExchangeRates UserConfigChild `gorm:"column:exchange_rates" json:"exchangeRates"` // 汇率配置,存储不同货币的汇率` PriceMultiplier decimal.Decimal `gorm:"column:price_multiplier;default:4.00" json:"priceMultiplier"` // 上品价格上浮倍率` MinStock int64 `gorm:"column:min_stock;default:30" json:"minStock"` // 最小库存,低于该库存不允许上品` FixedStock int64 `gorm:"column:fixed_stock" json:"fixedStock"` // 固定库存值,NULL 表示未设置` EnableDeduplication string `gorm:"column:enable_deduplication;default:'0'" json:"enableDeduplication"` // 是否启用去重检查` DefaultSize UserConfigChild `gorm:"column:default_size" json:"defaultSize"` // 默认尺寸配置,存储长、宽、高、重量等` EnableBlacklistFilter string `gorm:"column:enable_blacklist_filter;default:'0'" json:"enableBlacklistFilter"` // 是否启用违禁词过滤` ImportSource string `gorm:"column:import_source;default:'system'" json:"importSource"` // 导入方式` ExtraConfig ExtraConfig `gorm:"column:extra_config" json:"extraConfig"` // 额外的扩展配置` CreateTime int64 `gorm:"column:create_time" json:"createTime"` // 创建时间戳` UpdateTime int64 `gorm:"column:update_time" json:"updateTime"` // 更新时间戳` } func (UserConfig) TableName() string { return "user_config" } type ExtraConfig struct { } func (j *ExtraConfig) Scan(value interface{}) error { return json.Unmarshal(value.([]byte), &j) } func (j ExtraConfig) Value() (driver.Value, error) { return json.Marshal(j) } type UserConfigChild struct { Data []struct { Code string `json:"code"` Num decimal.Decimal `json:"num"` Unit string `json:"unit"` } `json:"data"` } func (j *UserConfigChild) Scan(value interface{}) error { return json.Unmarshal(value.([]byte), &j) } func (j UserConfigChild) Value() (driver.Value, error) { return json.Marshal(j) }