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.

82 lines
5.4 KiB

6 months ago
package model
import "shop-api/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"` // 创建人
// SaleStatus int `gorm:"type:tinyint(1);" json:"sale_status"` //销售状态 1:正常 2:已售罄
global.MG_MODEL
}
type TbGoodsView 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"` // 吊牌价(零售指导价)
Tags string `json:"tags"` // 标签
PriceMin float64 `json:"price_min"` // 最低规格价格
PriceMax float64 `json:"price_max"` // 最高规格价格
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"` // 图片
Content string `json:"content"` // 商品详情
ContentText string `json:"content_text"` // 详情-文字
ListPrice float64 `json:"list_price"` // 列表价格
RetailPrice float64 `json:"retail_price"` // 吊牌价(零售指导价)
PriceMin float64 `json:"price_min"` // 最低规格价格
PriceMax float64 `json:"price_max"` // 最高规格价格
Tags string `json:"tags"` // 标签
Online string `json:"online"` // 上下架状态 on/off
Attributes []TbAttributeWithValues `gorm:"-" json:"attributes"` // 规格详情
Specs []TbGoodsSpecsDetail `gorm:"ForeignKey:GoodsId;AssociationForeignKey:ID" json:"specs"` // 规格
CollectStatus bool `gorm:"-" json:"collect_status"` // 收藏状态 true:已收藏 false:未收藏
Breadcrumb []Breadcrumb `gorm:"-" json:"breadcrumb"` // 分类面包屑
global.MG_MODEL
}
func (TbGoods) TableName() string {
return "tb_goods"
}
func (TbGoodsView) TableName() string {
return "tb_goods"
}
func (TbGoodsDetail) TableName() string {
return "tb_goods"
}