You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
4.8 KiB

9 months ago
package model
import (
"pure-admin/global"
)
type TbGoodsBase struct {
SpuNo string `gorm:"unique;type:varchar(60);" json:"spu_no"` // 编号
Title string `gorm:"type:mediumtext" json:"title"` // 名称
TitleEng string `gorm:"type:mediumtext" json:"title_eng"` // 英文名称
Cover string `gorm:"type:varchar(255);" json:"cover"` // 封面图
Images string `gorm:"type:mediumtext;" json:"images"` // 图片
Content string `gorm:"type:mediumtext;" json:"content"` // 详情
ContentText string `gorm:"type:mediumtext;" json:"content_text"` // 详情-文字
RetailPrice float64 `gorm:"type:decimal(10,2);" json:"retail_price"` // 吊牌价(零售指导价)
PriceMin float64 `gorm:"type:decimal(10,2);" json:"price_min"` // 最低规格价格
PriceMax float64 `gorm:"type:decimal(10,2);" json:"price_max"` // 最高规格价格
StoreNo string `gorm:"type:varchar(60);" json:"store_no"` // 店铺编号
}
type TbGoods struct { // spu
TbGoodsBase
CategoryId uint `gorm:"type:int(11);not null;" json:"category_id"` // 分类id
ListPrice float64 `gorm:"type:decimal(10,2);" json:"list_price"` // 列表价格
AttributeList string `gorm:"type:text;" json:"attribute_list"` // 规格列表
Stock int64 `gorm:"type:int(11);comment:总库存" json:"stock"` // 总库存
Sales int64 `gorm:"type:int(11);comment:总销售量" json:"sales"` // 总销售量
Views int64 `gorm:"size:11;comment:商品浏览量" json:"views"` // 商品浏览量
Favourites int64 `gorm:"size:11;comment:商品喜欢量" json:"favourites"` // 商品喜欢量
CollectionNum int64 `gorm:"type:int(11)" json:"collection_num"` // 收藏人数
Tags string `gorm:"type:varchar(255);" json:"tags"` // 标签
Online string `gorm:"type:ENUM('on','off');comment:商品上下架状态" json:"online" form:"online"` // 上下架状态 on/off
CreateBy string `gorm:"size:64" json:"create_by"` // 创建人
StoreNo string `gorm:"type:varchar(60);" json:"store_no"` //店铺编号
// SaleStatus int `gorm:"type:tinyint(1);" json:"sale_status"` //销售状态 1:正常 2:已售罄
global.MG_MODEL
}
type TbGoods4List struct {
SpuNo string `json:"spu_no"` // 编号
Title string `json:"title"` // 标题
TitleEng string `json:"title_eng"` // 英文标题
Cover string `json:"cover"` // 封面图(未使用)
Images string `json:"images"` // 图片列表
RetailPrice float64 `json:"retail_price"` // 吊牌价(零售指导价)
PriceMin float64 `json:"price_min"` // 最低规格价格
PriceMax float64 `json:"price_max"` // 最高规格价格
Stock int64 `json:"stock"` // 总库存
Sales int64 `json:"sales"` // 总销售量
Sales30 int64 `json:"sales_30"` // 30天销售量
Status int `json:"status"` // 1:上架 2:下架 3:售罄
Online string `json:"-"` // 上下架状态 on/off
Tags string `json:"tags"` // 标签
global.MG_MODEL
}
type TbGoodsDetail struct {
CategoryId uint `json:"category_id"` // 分类id
SpuNo string `json:"spu_no"` // 编号
Title string `json:"title"` // 标题
TitleEng string `json:"title_eng"` // 英文标题
Cover string `json:"cover"` // 封面图(未使用)
Images string `json:"images"` // 图片
RetailPrice float64 `json:"retail_price"` // 吊牌价(零售指导价)
Content string `json:"content"` // 商品详情
ContentText string `json:"content_text"` // 商品详情-文字
Sales int64 `json:"sales"` //
Stock int64 `json:"stock"` // 总库存
Tags string `json:"tags"` // 标签
Online string `json:"online"` // 上下架状态 on/off
StoreNo string `json:"store_no"`
Specs []TbGoodsSpecsDetail `gorm:"ForeignKey:GoodsId;AssociationForeignKey:ID" json:"specs"` // 规格
global.MG_MODEL
}
func (TbGoods) TableName() string {
return "tb_goods"
}
func (TbGoods4List) TableName() string {
return "tb_goods"
}
func (TbGoodsDetail) TableName() string {
return "tb_goods"
}