Files
bl/modules/config/model/shop.go
昔念 026689f3ed ```
feat(cache): 添加复合键缓存操作支持

添加了基于 uint32+string 组合键的缓存操作方法,包括
GetByCompoundKey、SetByCompoundKey、DelByCompoundKey 和
ContainsByCompoundKey 方法,用于处理用户ID和会话ID的组合缓存场景

fix(vscode): 添加 cSpell 配置支持 struc 词汇

refactor(session): 移除过时的会话管理方法

移除了基于单一字符串键的会话管理方法,因为已迁移到使用
复合键的缓存操作方式
```
2026-01-19 18:51:56 +08:00

56 lines
2.1 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 (
TableNameShopConfig = "config_shop" // 商店配置表(记录商品信息、价格、库存、分类等)
)
// ShopConfig 商店商品核心配置模型
type ShopConfig struct {
*cool.Model `json:"-" gorm:"embedded"` // 嵌入通用ModelID/创建时间/更新时间不参与json序列化
// 核心字段
ProductName string `gorm:"not null;size:128;comment:'商品名称'" json:"product_name" description:"商品名称"`
//商品ID
ProductID uint32 `gorm:"not null;uniqueIndex;comment:'商品ID'" json:"product_id" description:"商品ID"`
Desc string `gorm:"not null;size:512;comment:'商品描述'" json:"desc" description:"商品描述"`
// 价格信息 -1代表不允许购买,0表示不支持购买
SeerdouPrice int32 `gorm:"not null;default:0;comment:'骄阳豆价格'" json:"seerdou_price" description:"骄阳豆价格"`
JindouPrice int32 `gorm:"not null;default:0;comment:'金豆价格'" json:"jindou_price" description:"金豆价格"`
// 库存信息
Stock uint32 `gorm:"not null;default:0;comment:'商品库存数量0表示无限库存'" json:"stock" description:"库存数量"`
// 状态信息
IsOnSale uint32 `gorm:"not null;default:1;comment:'是否上架0-下架 1-上架)'" json:"is_on_sale" description:"是否上架"`
// 限购信息
QuotaLimit uint32 `gorm:"not null;default:0;comment:'单位时间内的限购数量0表示不限购'" json:"quota_limit" description:"限购数量"`
QuotaCycle uint32 `gorm:"not null;default:0;comment:'限购周期单位小时0表示不限购'" json:"quota_cycle" description:"限购周期(小时)"`
}
// -------------------------- 核心配套方法(遵循项目规范)--------------------------
func (*ShopConfig) TableName() string {
return TableNameShopConfig
}
func (*ShopConfig) GroupName() string {
return "default"
}
func NewShopConfig() *ShopConfig {
return &ShopConfig{
Model: cool.NewModel(),
}
}
// -------------------------- 表结构自动同步 --------------------------
func init() {
cool.CreateTable(&ShopConfig{})
}