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.

49 lines
2.6 KiB

package goods
import (
"github.com/towgo/towgo/dao/basedboperat"
"src/module/itemGoodsSkuPrice"
"strconv"
)
func (SKUPrice) TableName() string {
return "sku_price"
}
// SKUPrice 结构体表示商品 SKU 的价格信息
type SKUPrice struct {
ID int64 `json:"id"` // SKU 价格的唯一标识
GoodsSkuIds []int64 `json:"goods_sku_ids"` // 商品 SKU 的标识数组
GoodsId int64 `json:"goods_id"` // 商品的唯一标识
Weigh int64 `json:"weigh"` // 权重
Image string `json:"image"` // 图片链接
Stock int64 `json:"stock"` // 库存
StockWarning interface{} `json:"stock_warning"` // 库存预警信息,根据实际情况调整数据类型
Sales int64 `json:"sales"` // 销量
SN string `json:"sn"` // 商品编号
Weight int64 `json:"weight"` // 重量
Price string `json:"price"` // 价格
GoodsSkuText string `json:"goods_sku_text"` // 商品 SKU 文本描述
Status string `json:"status"` // 状态
GrouponPrice string `json:"groupon_price"` // 团购价格
ActivityType string `json:"activity_type"` // 活动类型
ActivityId int64 `json:"activity_id"` // 活动的唯一标识
ItemGoodsSkuPrice itemGoodsSkuPrice.ItemGoodsSkuPrice `json:"item_goods_sku_price" xorm:"-"` // 商品 SKU 价格信息
GoodsSkuIdArr []string `json:"goods_sku_id_arr" xorm:"-"` // 商品 SKU 标识数组
}
func (sku *SKUPrice) AfterQuery(session basedboperat.DbTransactionSession) error {
var item itemGoodsSkuPrice.ItemGoodsSkuPrice
err := session.Get(&item, nil, "sku_price_id = ?", sku.ID)
if err != nil {
return err
}
sku.ItemGoodsSkuPrice = item
for _, id := range sku.GoodsSkuIds {
sku.GoodsSkuIdArr = append(sku.GoodsSkuIdArr, strconv.FormatInt(id, 10))
}
return nil
}