2026-01-03 01:35:32 +08:00
|
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"blazing/cool"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// 表名常量定义:商店配置表
|
|
|
|
|
|
const (
|
2026-01-19 18:51:56 +08:00
|
|
|
|
TableNameShopConfig = "config_shop" // 商店配置表(记录商品信息、价格、库存、分类等)
|
2026-01-03 01:35:32 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// ShopConfig 商店商品核心配置模型
|
|
|
|
|
|
type ShopConfig struct {
|
2026-02-13 22:57:05 +08:00
|
|
|
|
*BaseConfig
|
2026-02-23 01:33:31 +08:00
|
|
|
|
|
2026-02-13 03:04:04 +08:00
|
|
|
|
//商品类型
|
2026-02-23 01:33:31 +08:00
|
|
|
|
ProductType uint32 `gorm:"not null;default:0;comment:'商品类型'" json:"product_type" description:"商品类型"`
|
2026-02-13 03:04:04 +08:00
|
|
|
|
|
2026-01-05 01:04:52 +08:00
|
|
|
|
//商品ID
|
2026-02-13 22:57:05 +08:00
|
|
|
|
ProductID int64 `gorm:"not null;uniqueIndex;comment:'商品ID'" json:"product_id" description:"商品ID"`
|
2026-01-03 01:35:32 +08:00
|
|
|
|
|
2026-01-09 21:12:39 +08:00
|
|
|
|
// 价格信息 -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:"金豆价格"`
|
2026-01-03 01:35:32 +08:00
|
|
|
|
|
|
|
|
|
|
// 库存信息
|
|
|
|
|
|
Stock uint32 `gorm:"not null;default:0;comment:'商品库存数量(0表示无限库存)'" json:"stock" description:"库存数量"`
|
|
|
|
|
|
|
|
|
|
|
|
// 限购信息
|
2026-02-23 12:39:57 +08:00
|
|
|
|
QuotaLimit uint32 `gorm:"not null;default:0;comment:'单位时间内的限购数量'" json:"quota_limit" description:"限购数量"`
|
2026-02-23 00:57:07 +08:00
|
|
|
|
//限购类型
|
|
|
|
|
|
QuotaType uint32 `gorm:"not null;default:0;comment:'限购类型(0-不限购 1-每日限购 2-每周限购 3-每月限购)'" json:"quota_type" description:"限购类型"`
|
2026-01-03 01:35:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------- 核心配套方法(遵循项目规范)--------------------------
|
|
|
|
|
|
func (*ShopConfig) TableName() string {
|
|
|
|
|
|
return TableNameShopConfig
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (*ShopConfig) GroupName() string {
|
|
|
|
|
|
return "default"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func NewShopConfig() *ShopConfig {
|
|
|
|
|
|
return &ShopConfig{
|
2026-02-13 22:57:05 +08:00
|
|
|
|
BaseConfig: NewBaseConfig(),
|
2026-01-03 01:35:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------- 表结构自动同步 --------------------------
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
cool.CreateTable(&ShopConfig{})
|
2026-01-05 01:04:52 +08:00
|
|
|
|
}
|