2026-04-02 10:22:36 +08:00
|
|
|
|
package entity
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
knapsackConsts "shop-user-trade/consts/knapsack"
|
|
|
|
|
|
"shop-user-trade/model/config"
|
|
|
|
|
|
|
2026-06-10 16:39:09 +08:00
|
|
|
|
"gitea.redpowerfuture.com/red-future/common/beans"
|
2026-04-02 10:22:36 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type knapsackCol struct {
|
|
|
|
|
|
beans.SQLBaseCol
|
|
|
|
|
|
UserID string
|
|
|
|
|
|
AssetID string
|
|
|
|
|
|
AssetName string
|
|
|
|
|
|
SkuID string
|
|
|
|
|
|
SkuName string
|
|
|
|
|
|
SpecValues string
|
|
|
|
|
|
ImageURL string
|
|
|
|
|
|
Type string
|
|
|
|
|
|
StockDetailID string
|
|
|
|
|
|
BatchID string
|
|
|
|
|
|
BatchNo string
|
|
|
|
|
|
StockMode string
|
|
|
|
|
|
Status string
|
|
|
|
|
|
UsedAt string
|
|
|
|
|
|
ExpireAt string
|
|
|
|
|
|
PhysicalAssetConfig string
|
|
|
|
|
|
ServiceAssetConfig string
|
|
|
|
|
|
VirtualAssetConfig string
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var KnapsackCol = knapsackCol{
|
|
|
|
|
|
SQLBaseCol: beans.DefSQLBaseCol,
|
|
|
|
|
|
UserID: "user_id",
|
|
|
|
|
|
AssetID: "asset_id",
|
|
|
|
|
|
AssetName: "asset_name",
|
|
|
|
|
|
SkuID: "sku_id",
|
|
|
|
|
|
SkuName: "sku_name",
|
|
|
|
|
|
SpecValues: "spec_values",
|
|
|
|
|
|
ImageURL: "image_url",
|
|
|
|
|
|
Type: "type",
|
|
|
|
|
|
StockDetailID: "stock_detail_id",
|
|
|
|
|
|
BatchID: "batch_id",
|
|
|
|
|
|
BatchNo: "batch_no",
|
|
|
|
|
|
StockMode: "stock_mode",
|
|
|
|
|
|
Status: "status",
|
|
|
|
|
|
UsedAt: "used_at",
|
|
|
|
|
|
ExpireAt: "expire_at",
|
|
|
|
|
|
PhysicalAssetConfig: "physical_asset_config",
|
|
|
|
|
|
ServiceAssetConfig: "service_asset_config",
|
|
|
|
|
|
VirtualAssetConfig: "virtual_asset_config",
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Knapsack 背包实体
|
|
|
|
|
|
type Knapsack struct {
|
|
|
|
|
|
beans.SQLBaseDO `orm:",inherit"`
|
|
|
|
|
|
|
|
|
|
|
|
UserID int64 `orm:"user_id" json:"userId" description:"用户ID"`
|
|
|
|
|
|
AssetID int64 `orm:"asset_id" json:"assetId,string" description:"资产ID"`
|
|
|
|
|
|
AssetName string `orm:"asset_name" json:"assetName" description:"资产名称"`
|
|
|
|
|
|
SkuID int64 `orm:"sku_id" json:"skuId,string" description:"SKU ID"`
|
|
|
|
|
|
SkuName string `orm:"sku_name" json:"skuName" description:"SKU名称"`
|
|
|
|
|
|
SpecValues map[string]interface{} `orm:"spec_values" json:"specValues" description:"规格值(JSONB)"`
|
|
|
|
|
|
ImageURL string `orm:"image_url" json:"imageUrl" description:"资产图片URL"`
|
|
|
|
|
|
Type knapsackConsts.KnapsackAssetType `orm:"type" json:"type" description:"资产类型:physical/virtual/service"`
|
|
|
|
|
|
|
|
|
|
|
|
// 库存相关字段
|
|
|
|
|
|
StockDetailID int64 `orm:"stock_detail_id" json:"stockDetailId,string" description:"库存明细ID(明细模式)"`
|
|
|
|
|
|
BatchID int64 `orm:"batch_id" json:"batchId,string" description:"批次ID(批次模式)"`
|
|
|
|
|
|
BatchNo string `orm:"batch_no" json:"batchNo" description:"批次号(批次模式)"`
|
|
|
|
|
|
StockMode int `orm:"stock_mode" json:"stockMode" description:"库存管理模式:1-明细模式,2-批次模式"`
|
|
|
|
|
|
|
|
|
|
|
|
// 状态字段
|
|
|
|
|
|
Status knapsackConsts.KnapsackStatus `orm:"status" json:"status" description:"状态:0禁用/1启用/2已使用/3已上架/4已过期"`
|
|
|
|
|
|
UsedAt *int64 `orm:"used_at" json:"usedAt,omitempty" description:"使用时间(时间戳)"`
|
|
|
|
|
|
ExpireAt *int64 `orm:"expire_at" json:"expireAt,omitempty" description:"过期时间(时间戳)"`
|
|
|
|
|
|
|
|
|
|
|
|
// 类型专用配置(JSONB)
|
|
|
|
|
|
PhysicalAssetConfig *config.PhysicalKnapsackConfig `orm:"physical_asset_config" json:"physicalAssetConfig,omitempty" description:"实物资产配置(JSONB)"`
|
|
|
|
|
|
ServiceAssetConfig *config.ServiceKnapsackConfig `orm:"service_asset_config" json:"serviceAssetConfig,omitempty" description:"服务资产配置(JSONB)"`
|
|
|
|
|
|
VirtualAssetConfig *config.VirtualKnapsackConfig `orm:"virtual_asset_config" json:"virtualAssetConfig,omitempty" description:"虚拟资产配置(JSONB)"`
|
|
|
|
|
|
}
|