代码初始化
This commit is contained in:
82
model/entity/knapsack/knapsack.go
Normal file
82
model/entity/knapsack/knapsack.go
Normal file
@@ -0,0 +1,82 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
knapsackConsts "shop-user-trade/consts/knapsack"
|
||||
"shop-user-trade/model/config"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
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)"`
|
||||
}
|
||||
19
model/entity/knapsack/knapsack_log.go
Normal file
19
model/entity/knapsack/knapsack_log.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
knapsackConsts "shop-user-trade/consts/knapsack"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
// KnapsackLog 背包操作日志实体
|
||||
type KnapsackLog struct {
|
||||
beans.SQLBaseDO `orm:",inherit"`
|
||||
|
||||
KnapsackID int64 `orm:"knapsack_id" json:"knapsackId,string" description:"背包项ID"`
|
||||
UserID int64 `orm:"user_id" json:"userId,string" description:"用户ID"`
|
||||
Action knapsackConsts.KnapsackActionType `orm:"action" json:"action" description:"操作类型"`
|
||||
OperatorID int64 `orm:"operator_id" json:"operatorId,string" description:"操作者ID"`
|
||||
OperatorName string `orm:"operator_name" json:"operatorName" description:"操作者名称"`
|
||||
Description string `orm:"description" json:"description" description:"操作描述"`
|
||||
}
|
||||
80
model/entity/market/market.go
Normal file
80
model/entity/market/market.go
Normal file
@@ -0,0 +1,80 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
marketConsts "shop-user-trade/consts/market"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
type marketCol struct {
|
||||
beans.SQLBaseCol
|
||||
KnapsackID string
|
||||
UserID string
|
||||
AssetID string
|
||||
AssetName string
|
||||
SkuID string
|
||||
SkuName string
|
||||
ImageURL string
|
||||
Type string
|
||||
StockDetailID string
|
||||
BatchID string
|
||||
BatchNo string
|
||||
StockMode string
|
||||
Price string
|
||||
OriginalPrice string
|
||||
Description string
|
||||
Status string
|
||||
ListExpireAt string
|
||||
}
|
||||
|
||||
var MarketCol = marketCol{
|
||||
SQLBaseCol: beans.DefSQLBaseCol,
|
||||
KnapsackID: "knapsack_id",
|
||||
UserID: "user_id",
|
||||
AssetID: "asset_id",
|
||||
AssetName: "asset_name",
|
||||
SkuID: "sku_id",
|
||||
SkuName: "sku_name",
|
||||
ImageURL: "image_url",
|
||||
Type: "type",
|
||||
StockDetailID: "stock_detail_id",
|
||||
BatchID: "batch_id",
|
||||
BatchNo: "batch_no",
|
||||
StockMode: "stock_mode",
|
||||
Price: "price",
|
||||
OriginalPrice: "original_price",
|
||||
Description: "description",
|
||||
Status: "status",
|
||||
ListExpireAt: "list_expire_at",
|
||||
}
|
||||
|
||||
// Market 市场实体
|
||||
type Market struct {
|
||||
beans.SQLBaseDO `orm:",inherit"`
|
||||
|
||||
KnapsackID int64 `orm:"knapsack_id" json:"knapsackId,string" description:"背包项ID"`
|
||||
UserID int64 `orm:"user_id" json:"userId,string" 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名称"`
|
||||
ImageURL string `orm:"image_url" json:"imageUrl" description:"资产图片URL"`
|
||||
Type string `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-批次模式"`
|
||||
|
||||
// 交易相关字段
|
||||
Price int64 `orm:"price" json:"price" description:"售价(分)"`
|
||||
OriginalPrice int64 `orm:"original_price" json:"originalPrice" description:"原价(分)"`
|
||||
Description string `orm:"description" json:"description" description:"描述信息"`
|
||||
|
||||
// 状态字段
|
||||
Status marketConsts.MarketStatus `orm:"status" json:"status" description:"状态:1活跃/2已售/3下架/4过期"`
|
||||
|
||||
// 上架过期时间
|
||||
ListExpireAt *int64 `orm:"list_expire_at" json:"listExpireAt,omitempty" description:"上架过期时间(时间戳)"`
|
||||
}
|
||||
20
model/entity/market/market_log.go
Normal file
20
model/entity/market/market_log.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
marketConsts "shop-user-trade/consts/market"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
// MarketLog 市场操作日志实体
|
||||
type MarketLog struct {
|
||||
beans.SQLBaseDO `orm:",inherit"`
|
||||
|
||||
MarketID int64 `orm:"market_id" json:"marketId,string" description:"市场物品ID"`
|
||||
KnapsackID int64 `orm:"knapsack_id" json:"knapsackId,string" description:"背包项ID"`
|
||||
UserID int64 `orm:"user_id" json:"userId,string" description:"用户ID"`
|
||||
Action marketConsts.MarketActionType `orm:"action" json:"action" description:"操作类型"`
|
||||
OperatorID int64 `orm:"operator_id" json:"operatorId,string" description:"操作者ID"`
|
||||
OperatorName string `orm:"operator_name" json:"operatorName" description:"操作者名称"`
|
||||
Description string `orm:"description" json:"description" description:"操作描述"`
|
||||
}
|
||||
36
model/entity/wallet/wallet.go
Normal file
36
model/entity/wallet/wallet.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
walletConsts "shop-user-trade/consts/wallet"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
type walletCol struct {
|
||||
beans.SQLBaseCol
|
||||
UserID string
|
||||
Balance string
|
||||
Currency string
|
||||
Status string
|
||||
Version string
|
||||
}
|
||||
|
||||
var WalletCol = walletCol{
|
||||
SQLBaseCol: beans.DefSQLBaseCol,
|
||||
UserID: "user_id",
|
||||
Balance: "balance",
|
||||
Currency: "currency",
|
||||
Status: "status",
|
||||
Version: "version",
|
||||
}
|
||||
|
||||
// Wallet 钱包实体
|
||||
type Wallet struct {
|
||||
beans.SQLBaseDO `orm:",inherit"`
|
||||
|
||||
UserID int64 `orm:"user_id" json:"userId,string" description:"用户ID"`
|
||||
Balance int64 `orm:"balance" json:"balance" description:"余额(分)"`
|
||||
Currency string `orm:"currency" json:"currency" description:"货币类型:CNY-人民币"`
|
||||
Status walletConsts.WalletStatus `orm:"status" json:"status" description:"状态:1启用/0禁用/-1冻结"`
|
||||
Version int64 `orm:"version" json:"version" description:"乐观锁版本号"`
|
||||
}
|
||||
24
model/entity/wallet/wallet_log.go
Normal file
24
model/entity/wallet/wallet_log.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
walletConsts "shop-user-trade/consts/wallet"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
// WalletLog 钱包操作日志实体
|
||||
type WalletLog struct {
|
||||
beans.SQLBaseDO `orm:",inherit"`
|
||||
|
||||
UserID int64 `orm:"user_id" json:"userId,string" description:"用户ID"`
|
||||
WalletID int64 `orm:"wallet_id" json:"walletId,string" description:"钱包ID"`
|
||||
OrderNo string `orm:"order_no" json:"orderNo" description:"业务订单号"`
|
||||
TransactionNo string `orm:"transaction_no" json:"transactionNo" description:"钱包交易流水号"`
|
||||
Type walletConsts.WalletLogType `orm:"type" json:"type" description:"操作类型"`
|
||||
Amount int64 `orm:"amount" json:"amount" description:"金额(分)"`
|
||||
BalanceBefore int64 `orm:"balance_before" json:"balanceBefore" description:"操作前余额"`
|
||||
BalanceAfter int64 `orm:"balance_after" json:"balanceAfter" description:"操作后余额"`
|
||||
Currency string `orm:"currency" json:"currency" description:"货币类型"`
|
||||
Description string `orm:"description" json:"description" description:"描述"`
|
||||
ExtraData map[string]interface{} `orm:"extra_data" json:"extraData" description:"额外数据(JSONB)"`
|
||||
}
|
||||
33
model/entity/wallet/wallet_log_col.go
Normal file
33
model/entity/wallet/wallet_log_col.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package entity
|
||||
|
||||
import "gitea.com/red-future/common/beans"
|
||||
|
||||
type walletLogCol struct {
|
||||
beans.SQLBaseCol
|
||||
UserID string
|
||||
WalletID string
|
||||
OrderNo string
|
||||
TransactionNo string
|
||||
Type string
|
||||
Amount string
|
||||
BalanceBefore string
|
||||
BalanceAfter string
|
||||
Currency string
|
||||
Description string
|
||||
ExtraData string
|
||||
}
|
||||
|
||||
var WalletLogCol = walletLogCol{
|
||||
SQLBaseCol: beans.DefSQLBaseCol,
|
||||
UserID: "user_id",
|
||||
WalletID: "wallet_id",
|
||||
OrderNo: "order_no",
|
||||
TransactionNo: "transaction_no",
|
||||
Type: "type",
|
||||
Amount: "amount",
|
||||
BalanceBefore: "balance_before",
|
||||
BalanceAfter: "balance_after",
|
||||
Currency: "currency",
|
||||
Description: "description",
|
||||
ExtraData: "extra_data",
|
||||
}
|
||||
Reference in New Issue
Block a user