代码初始化
This commit is contained in:
80
model/config/knapsack_config.go
Normal file
80
model/config/knapsack_config.go
Normal file
@@ -0,0 +1,80 @@
|
||||
package config
|
||||
|
||||
import "shop-user-trade/consts/knapsack"
|
||||
|
||||
// KnapsackAssetConfigInterface 背包资产配置接口
|
||||
type KnapsackAssetConfigInterface interface {
|
||||
GetType() knapsack.KnapsackAssetType
|
||||
}
|
||||
|
||||
// PhysicalKnapsackConfig 实物资产背包配置
|
||||
type PhysicalKnapsackConfig struct {
|
||||
Shipping PhysicalShippingConfig `orm:"shipping" json:"shipping"`
|
||||
}
|
||||
|
||||
// PhysicalShippingConfig 实物配送配置
|
||||
type PhysicalShippingConfig struct {
|
||||
DeliveryMethod string `json:"deliveryMethod"` // 配送方式
|
||||
}
|
||||
|
||||
func (PhysicalKnapsackConfig) GetType() knapsack.KnapsackAssetType {
|
||||
return knapsack.KnapsackAssetTypePhysical
|
||||
}
|
||||
|
||||
// ServiceKnapsackConfig 服务资产背包配置
|
||||
type ServiceKnapsackConfig struct {
|
||||
ServiceAssetType knapsack.ServiceAssetType `json:"serviceType"`
|
||||
ServiceAssetArrivalConfig ServiceAssetArrivalConfig `json:"serviceArrivalConfig"`
|
||||
}
|
||||
|
||||
type ServiceAssetArrivalConfig struct {
|
||||
Schedule ScheduleConfig `json:"schedule,omitempty"`
|
||||
Booking BookingConfig `json:"booking,omitempty"`
|
||||
}
|
||||
|
||||
type ScheduleConfig struct {
|
||||
TimeSlots []TimeSlot `json:"timeSlots"`
|
||||
Exceptions []ScheduleException `json:"exceptions,omitempty"`
|
||||
}
|
||||
|
||||
type BookingConfig struct {
|
||||
MinAdvance int `json:"minAdvance,omitempty"`
|
||||
MinDuration int `json:"minDuration,omitempty"`
|
||||
CancelWindow int `json:"cancelWindow,omitempty"`
|
||||
}
|
||||
|
||||
type TimeSlot struct {
|
||||
DayOfWeek string `json:"dayOfWeek"`
|
||||
StartTime string `json:"startTime"`
|
||||
EndTime string `json:"endTime"`
|
||||
Capacity int `json:"capacity,omitempty"`
|
||||
}
|
||||
|
||||
type ScheduleException struct {
|
||||
Date string `json:"date"`
|
||||
Status int `json:"status"`
|
||||
Reason string `json:"reason,omitempty"`
|
||||
DayOfWeek string `json:"dayOfWeek"`
|
||||
}
|
||||
|
||||
func (ServiceKnapsackConfig) GetType() knapsack.KnapsackAssetType {
|
||||
return knapsack.KnapsackAssetTypeService
|
||||
}
|
||||
|
||||
// VirtualKnapsackConfig 虚拟资产背包配置
|
||||
type VirtualKnapsackConfig struct {
|
||||
VirtualAssetType knapsack.VirtualAssetType `json:"virtualType"`
|
||||
CollectionPrice int64 `json:"collectionPrice,omitempty"`
|
||||
ApiConfig *VirtualApiConfig `json:"apiConfig,omitempty"`
|
||||
}
|
||||
|
||||
type VirtualApiConfig struct {
|
||||
Method string `json:"method"`
|
||||
RequestURL string `json:"requestUrl"`
|
||||
Headers map[string]string `json:"headers,omitempty"`
|
||||
AuthType string `json:"authType,omitempty"`
|
||||
}
|
||||
|
||||
func (VirtualKnapsackConfig) GetType() knapsack.KnapsackAssetType {
|
||||
return knapsack.KnapsackAssetTypeVirtual
|
||||
}
|
||||
35
model/config/market_config.go
Normal file
35
model/config/market_config.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package config
|
||||
|
||||
// MarketConfigInterface 市场配置接口
|
||||
type MarketConfigInterface interface {
|
||||
GetMarketType() string
|
||||
}
|
||||
|
||||
// PhysicalMarketConfig 实物市场配置
|
||||
type PhysicalMarketConfig struct {
|
||||
DeliveryMethod string `json:"deliveryMethod"`
|
||||
DeliveryFee int64 `json:"deliveryFee"`
|
||||
}
|
||||
|
||||
func (PhysicalMarketConfig) GetMarketType() string {
|
||||
return "physical"
|
||||
}
|
||||
|
||||
// ServiceMarketConfig 服务市场配置
|
||||
type ServiceMarketConfig struct {
|
||||
ServiceLocation string `json:"serviceLocation"`
|
||||
ServiceDuration int `json:"serviceDuration"`
|
||||
}
|
||||
|
||||
func (ServiceMarketConfig) GetMarketType() string {
|
||||
return "service"
|
||||
}
|
||||
|
||||
// VirtualMarketConfig 虚拟市场配置
|
||||
type VirtualMarketConfig struct {
|
||||
TransferMethod string `json:"transferMethod"`
|
||||
}
|
||||
|
||||
func (VirtualMarketConfig) GetMarketType() string {
|
||||
return "virtual"
|
||||
}
|
||||
180
model/dto/knapsack/knapsack_dto.go
Normal file
180
model/dto/knapsack/knapsack_dto.go
Normal file
@@ -0,0 +1,180 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
knapsackConsts "shop-user-trade/consts/knapsack"
|
||||
"shop-user-trade/model/config"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// CreateKnapsackReq 创建背包项请求
|
||||
type CreateKnapsackReq struct {
|
||||
g.Meta `path:"/createKnapsack" method:"post" tags:"背包管理" summary:"创建背包项" dc:"创建新的背包项"`
|
||||
|
||||
UserID int64 `json:"userId" v:"required" dc:"用户ID"`
|
||||
AssetID int64 `json:"assetId" v:"required" dc:"资产ID"`
|
||||
AssetName string `json:"assetName" v:"required" dc:"资产名称"`
|
||||
SkuID int64 `json:"skuId,omitempty" dc:"SKU ID"`
|
||||
SkuName string `json:"skuName,omitempty" dc:"SKU名称"`
|
||||
SpecValues map[string]interface{} `json:"specValues,omitempty" dc:"规格值"`
|
||||
ImageURL string `json:"imageUrl" dc:"资产图片URL"`
|
||||
Type knapsackConsts.KnapsackAssetType `json:"type" v:"required" dc:"资产类型"`
|
||||
StockDetailID int64 `json:"stockDetailId,omitempty" dc:"库存明细ID(明细模式)"`
|
||||
BatchID int64 `json:"batchId,omitempty" dc:"批次ID(批次模式)"`
|
||||
BatchNo string `json:"batchNo,omitempty" dc:"批次号(批次模式)"`
|
||||
StockMode int `json:"stockMode" v:"required" dc:"库存管理模式:1-明细模式,2-批次模式"`
|
||||
ExpireAt *int64 `json:"expireAt,omitempty" dc:"过期时间(时间戳)"`
|
||||
PhysicalAssetConfig *config.PhysicalKnapsackConfig `json:"physicalAssetConfig,omitempty" dc:"实物资产配置"`
|
||||
ServiceAssetConfig *config.ServiceKnapsackConfig `json:"serviceAssetConfig,omitempty" dc:"服务资产配置"`
|
||||
VirtualAssetConfig *config.VirtualKnapsackConfig `json:"virtualAssetConfig,omitempty" dc:"虚拟资产配置"`
|
||||
}
|
||||
|
||||
// GetKnapsackReq 获取背包项请求
|
||||
type GetKnapsackReq struct {
|
||||
g.Meta `path:"/getKnapsack" method:"get" tags:"背包管理" summary:"获取背包项" dc:"获取背包项详情"`
|
||||
|
||||
Id int64 `json:"id" v:"required" dc:"背包项ID"`
|
||||
}
|
||||
|
||||
// UpdateKnapsackReq 更新背包项请求(内部使用)
|
||||
type UpdateKnapsackReq struct {
|
||||
Id int64 `json:"id" v:"required" dc:"背包项ID"`
|
||||
Status *knapsackConsts.KnapsackStatus `json:"status,omitempty" dc:"状态"`
|
||||
UsedAt *int64 `json:"usedAt,omitempty" dc:"使用时间"`
|
||||
Updater string `json:"updater,omitempty" dc:"更新者"`
|
||||
}
|
||||
|
||||
// DeleteKnapsackReq 删除背包项请求
|
||||
type DeleteKnapsackReq struct {
|
||||
g.Meta `path:"/deleteKnapsack" method:"delete" tags:"背包管理" summary:"删除背包项" dc:"删除背包项"`
|
||||
|
||||
Id int64 `json:"id" v:"required" dc:"背包项ID"`
|
||||
}
|
||||
|
||||
// ListKnapsackReq 获取背包列表请求
|
||||
type ListKnapsackReq struct {
|
||||
g.Meta `path:"/listKnapsack" method:"get" tags:"背包管理" summary:"获取背包列表" dc:"分页查询背包列表,支持多条件筛选"`
|
||||
*beans.Page
|
||||
|
||||
UserID int64 `json:"userId,omitempty" dc:"用户ID"`
|
||||
Status *int `json:"status,omitempty" dc:"状态"`
|
||||
Type string `json:"type,omitempty" dc:"资产类型"`
|
||||
Keyword string `json:"keyword,omitempty" dc:"关键词搜索"`
|
||||
}
|
||||
|
||||
// UseKnapsackReq 使用背包项请求
|
||||
type UseKnapsackReq struct {
|
||||
g.Meta `path:"/useKnapsack" method:"post" tags:"背包管理" summary:"使用背包项" dc:"手动使用背包中的物品"`
|
||||
|
||||
ID int64 `json:"id" v:"required" dc:"背包项ID"`
|
||||
OperatorID int64 `json:"operatorId" v:"required" dc:"操作者ID"`
|
||||
OperatorName string `json:"operatorName" v:"required" dc:"操作者名称"`
|
||||
Reason string `json:"reason,omitempty" dc:"使用原因"`
|
||||
}
|
||||
|
||||
// ListToMarketReq 上架背包项请求
|
||||
type ListToMarketReq struct {
|
||||
g.Meta `path:"/listToMarket" method:"post" tags:"背包管理" summary:"上架到市场" dc:"将背包项上架到市场"`
|
||||
|
||||
ID int64 `json:"id" v:"required" dc:"背包项ID"`
|
||||
OperatorID int64 `json:"operatorId" v:"required" dc:"操作者ID"`
|
||||
OperatorName string `json:"operatorName" v:"required" dc:"操作者名称"`
|
||||
}
|
||||
|
||||
// UnlistKnapsackReq 下架背包项请求
|
||||
type UnlistKnapsackReq struct {
|
||||
g.Meta `path:"/unlistKnapsack" method:"post" tags:"背包管理" summary:"从市场下架" dc:"将背包项从市场下架"`
|
||||
|
||||
ID int64 `json:"id" v:"required" dc:"背包项ID"`
|
||||
OperatorID int64 `json:"operatorId" v:"required" dc:"操作者ID"`
|
||||
OperatorName string `json:"operatorName" v:"required" dc:"操作者名称"`
|
||||
}
|
||||
|
||||
// VerifyKnapsackReq 核销背包项请求
|
||||
type VerifyKnapsackReq struct {
|
||||
g.Meta `path:"/verifyKnapsack" method:"post" tags:"背包管理" summary:"核销背包项" dc:"核销背包中的物品"`
|
||||
|
||||
ID int64 `json:"id" v:"required" dc:"背包项ID"`
|
||||
OperatorID int64 `json:"operatorId" v:"required" dc:"操作者ID"`
|
||||
OperatorName string `json:"operatorName" v:"required" dc:"操作者名称"`
|
||||
VerifyLocation string `json:"verifyLocation,omitempty" dc:"核销位置"`
|
||||
VerifyDevice string `json:"verifyDevice,omitempty" dc:"核销设备"`
|
||||
}
|
||||
|
||||
// GenerateQRCodeReq 生成二维码请求
|
||||
type GenerateQRCodeReq struct {
|
||||
g.Meta `path:"/generateQRCode" method:"post" tags:"背包管理" summary:"生成核销二维码" dc:"生成用于核销的二维码"`
|
||||
|
||||
ID int64 `json:"id" v:"required" dc:"背包项ID"`
|
||||
ExpireDuration int64 `json:"expireDuration" v:"required" dc:"过期时长(秒)"`
|
||||
}
|
||||
|
||||
// ========== 响应 ==========
|
||||
|
||||
// CreateKnapsackRes 创建背包项响应
|
||||
type CreateKnapsackRes struct {
|
||||
ID int64 `json:"id" dc:"背包项ID"`
|
||||
}
|
||||
|
||||
// GetKnapsackRes 获取背包项响应
|
||||
type GetKnapsackRes struct {
|
||||
*KnapsackItem
|
||||
}
|
||||
|
||||
// ListKnapsackRes 获取背包列表响应
|
||||
type ListKnapsackRes struct {
|
||||
List []*KnapsackItem `json:"list" dc:"背包列表"`
|
||||
Total int `json:"total" dc:"总数"`
|
||||
}
|
||||
|
||||
// UseKnapsackRes 使用背包项响应
|
||||
type UseKnapsackRes struct {
|
||||
Success bool `json:"success"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// ListToMarketRes 上架背包项响应
|
||||
type ListToMarketRes struct {
|
||||
Success bool `json:"success"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// UnlistKnapsackRes 下架背包项响应
|
||||
type UnlistKnapsackRes struct {
|
||||
Success bool `json:"success"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// VerifyKnapsackRes 核销背包项响应
|
||||
type VerifyKnapsackRes struct {
|
||||
Success bool `json:"success"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// GenerateQRCodeRes 生成二维码响应
|
||||
type GenerateQRCodeRes struct {
|
||||
QRCode string `json:"qrCode,omitempty"`
|
||||
VerifyCode string `json:"verifyCode,omitempty"`
|
||||
}
|
||||
|
||||
// KnapsackItem 背包项视图
|
||||
type KnapsackItem struct {
|
||||
ID int64 `json:"id" dc:"背包项ID"`
|
||||
UserID int64 `json:"userId" dc:"用户ID"`
|
||||
AssetID int64 `json:"assetId" dc:"资产ID"`
|
||||
AssetName string `json:"assetName" dc:"资产名称"`
|
||||
SkuID int64 `json:"skuId,omitempty" dc:"SKU ID"`
|
||||
SkuName string `json:"skuName,omitempty" dc:"SKU名称"`
|
||||
ImageURL string `json:"imageUrl" dc:"资产图片URL"`
|
||||
Type knapsackConsts.KnapsackAssetType `json:"type" dc:"资产类型"`
|
||||
Status knapsackConsts.KnapsackStatus `json:"status" dc:"状态"`
|
||||
ExpireAt *int64 `json:"expireAt,omitempty" dc:"过期时间"`
|
||||
// 库存相关字段
|
||||
StockDetailID int64 `json:"stockDetailId,omitempty" dc:"库存明细ID"`
|
||||
BatchID int64 `json:"batchId,omitempty" dc:"批次ID"`
|
||||
BatchNo string `json:"batchNo,omitempty" dc:"批次号"`
|
||||
StockMode int `json:"stockMode" dc:"库存管理模式"`
|
||||
CreatedAt string `json:"createdAt" dc:"创建时间"`
|
||||
UpdatedAt string `json:"updatedAt" dc:"更新时间"`
|
||||
}
|
||||
158
model/dto/market/market_dto.go
Normal file
158
model/dto/market/market_dto.go
Normal file
@@ -0,0 +1,158 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
marketConsts "shop-user-trade/consts/market"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// CreateMarketReq 创建市场物品请求
|
||||
type CreateMarketReq struct {
|
||||
g.Meta `path:"/createMarket" method:"post" tags:"市场管理" summary:"创建市场物品" dc:"将背包项上架到市场"`
|
||||
|
||||
KnapsackID int64 `json:"knapsackId" v:"required" dc:"背包项ID"`
|
||||
UserID int64 `json:"userId" v:"required" dc:"卖家用户ID"`
|
||||
AssetID int64 `json:"assetId" v:"required" dc:"资产ID"`
|
||||
AssetName string `json:"assetName" v:"required" dc:"资产名称"`
|
||||
SkuID int64 `json:"skuId,omitempty" dc:"SKU ID"`
|
||||
SkuName string `json:"skuName,omitempty" dc:"SKU名称"`
|
||||
ImageURL string `json:"imageUrl" dc:"资产图片URL"`
|
||||
Type string `json:"type" v:"required" dc:"资产类型"`
|
||||
Price int64 `json:"price" v:"required" dc:"售价(分)"`
|
||||
OriginalPrice int64 `json:"originalPrice,omitempty" dc:"原价(分)"`
|
||||
Description string `json:"description,omitempty" dc:"描述信息"`
|
||||
ListExpireAt *int64 `json:"listExpireAt,omitempty" dc:"上架过期时间(时间戳)"`
|
||||
OperatorID int64 `json:"operatorId" v:"required" dc:"操作者ID"`
|
||||
OperatorName string `json:"operatorName" v:"required" dc:"操作者名称"`
|
||||
// 库存相关字段
|
||||
StockDetailID int64 `json:"stockDetailId,omitempty" dc:"库存明细ID(明细模式)"`
|
||||
BatchID int64 `json:"batchId,omitempty" dc:"批次ID(批次模式)"`
|
||||
BatchNo string `json:"batchNo,omitempty" dc:"批次号(批次模式)"`
|
||||
StockMode int `json:"stockMode" v:"required" dc:"库存管理模式:1-明细模式,2-批次模式"`
|
||||
}
|
||||
|
||||
// GetMarketReq 获取市场物品请求
|
||||
type GetMarketReq struct {
|
||||
g.Meta `path:"/getMarket" method:"get" tags:"市场管理" summary:"获取市场物品" dc:"获取市场物品详情"`
|
||||
|
||||
Id int64 `json:"id" v:"required" dc:"市场物品ID"`
|
||||
}
|
||||
|
||||
// UpdateMarketReq 更新市场物品请求(内部使用)
|
||||
type UpdateMarketReq struct {
|
||||
Id int64 `json:"id" v:"required" dc:"市场物品ID"`
|
||||
Price *int64 `json:"price,omitempty" dc:"售价(分)"`
|
||||
OriginalPrice *int64 `json:"originalPrice,omitempty" dc:"原价(分)"`
|
||||
Description string `json:"description,omitempty" dc:"描述信息"`
|
||||
Status *marketConsts.MarketStatus `json:"status,omitempty" dc:"状态"`
|
||||
ListExpireAt *int64 `json:"listExpireAt,omitempty" dc:"上架过期时间"`
|
||||
Updater string `json:"updater,omitempty" dc:"更新者"`
|
||||
}
|
||||
|
||||
// DeleteMarketReq 删除市场物品请求
|
||||
type DeleteMarketReq struct {
|
||||
g.Meta `path:"/deleteMarket" method:"delete" tags:"市场管理" summary:"删除市场物品" dc:"删除市场物品"`
|
||||
|
||||
Id int64 `json:"id" v:"required" dc:"市场物品ID"`
|
||||
}
|
||||
|
||||
// ListMarketReq 获取市场列表请求
|
||||
type ListMarketReq struct {
|
||||
g.Meta `path:"/listMarkets" method:"get" tags:"市场管理" summary:"获取市场列表" dc:"分页查询市场列表,支持多条件筛选"`
|
||||
*beans.Page
|
||||
|
||||
UserID int64 `json:"userId,omitempty" dc:"用户ID"`
|
||||
Status *int `json:"status,omitempty" dc:"状态"`
|
||||
Type string `json:"type,omitempty" dc:"资产类型"`
|
||||
Keyword string `json:"keyword,omitempty" dc:"关键词搜索"`
|
||||
}
|
||||
|
||||
// UnlistMarketReq 下架市场物品请求
|
||||
type UnlistMarketReq struct {
|
||||
g.Meta `path:"/unlistMarket" method:"post" tags:"市场管理" summary:"下架市场物品" dc:"将市场物品下架"`
|
||||
|
||||
ID int64 `json:"id" v:"required" dc:"市场物品ID"`
|
||||
OperatorID int64 `json:"operatorId" v:"required" dc:"操作者ID"`
|
||||
OperatorName string `json:"operatorName" v:"required" dc:"操作者名称"`
|
||||
Reason string `json:"reason,omitempty" dc:"下架原因"`
|
||||
}
|
||||
|
||||
// UpdatePriceReq 更新价格请求
|
||||
type UpdatePriceReq struct {
|
||||
g.Meta `path:"/updatePrice" method:"post" tags:"市场管理" summary:"更新价格" dc:"更新市场物品价格"`
|
||||
|
||||
ID int64 `json:"id" v:"required" dc:"市场物品ID"`
|
||||
Price int64 `json:"price" v:"required" dc:"新价格(分)"`
|
||||
OperatorID int64 `json:"operatorId" v:"required" dc:"操作者ID"`
|
||||
OperatorName string `json:"operatorName" v:"required" dc:"操作者名称"`
|
||||
}
|
||||
|
||||
// BuyMarketReq 购买市场物品请求
|
||||
type BuyMarketReq struct {
|
||||
g.Meta `path:"/buyMarket" method:"post" tags:"市场管理" summary:"购买市场物品" dc:"购买市场中的物品"`
|
||||
|
||||
MarketID int64 `json:"marketId" v:"required" dc:"市场物品ID"`
|
||||
BuyerID int64 `json:"buyerId" v:"required" dc:"买家ID"`
|
||||
BuyerName string `json:"buyerName" v:"required" dc:"买家名称"`
|
||||
}
|
||||
|
||||
// ========== 响应 ==========
|
||||
|
||||
// CreateMarketRes 创建市场物品响应
|
||||
type CreateMarketRes struct {
|
||||
ID int64 `json:"id" dc:"市场物品ID"`
|
||||
}
|
||||
|
||||
// GetMarketRes 获取市场物品响应
|
||||
type GetMarketRes struct {
|
||||
*MarketItem
|
||||
}
|
||||
|
||||
// ListMarketRes 获取市场列表响应
|
||||
type ListMarketRes struct {
|
||||
List []*MarketItem `json:"list" dc:"市场列表"`
|
||||
Total int `json:"total" dc:"总数"`
|
||||
}
|
||||
|
||||
// UnlistMarketRes 下架市场物品响应
|
||||
type UnlistMarketRes struct {
|
||||
Success bool `json:"success"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// UpdatePriceRes 更新价格响应
|
||||
type UpdatePriceRes struct {
|
||||
Success bool `json:"success"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// BuyMarketRes 购买市场物品响应
|
||||
type BuyMarketRes struct {
|
||||
OrderNo string `json:"orderNo"`
|
||||
}
|
||||
|
||||
// MarketItem 市场物品视图
|
||||
type MarketItem struct {
|
||||
ID int64 `json:"id" dc:"市场物品ID"`
|
||||
KnapsackID int64 `json:"knapsackId" dc:"背包项ID"`
|
||||
UserID int64 `json:"userId" dc:"卖家用户ID"`
|
||||
AssetID int64 `json:"assetId" dc:"资产ID"`
|
||||
AssetName string `json:"assetName" dc:"资产名称"`
|
||||
SkuID int64 `json:"skuId,omitempty" dc:"SKU ID"`
|
||||
SkuName string `json:"skuName,omitempty" dc:"SKU名称"`
|
||||
ImageURL string `json:"imageUrl" dc:"资产图片URL"`
|
||||
Type string `json:"type" dc:"资产类型"`
|
||||
Price int64 `json:"price" dc:"售价(分)"`
|
||||
OriginalPrice int64 `json:"originalPrice" dc:"原价(分)"`
|
||||
Description string `json:"description" dc:"描述信息"`
|
||||
Status marketConsts.MarketStatus `json:"status" dc:"状态"`
|
||||
ListExpireAt *int64 `json:"listExpireAt,omitempty" dc:"上架过期时间"`
|
||||
// 库存相关字段
|
||||
StockDetailID int64 `json:"stockDetailId,omitempty" dc:"库存明细ID"`
|
||||
BatchID int64 `json:"batchId,omitempty" dc:"批次ID"`
|
||||
BatchNo string `json:"batchNo,omitempty" dc:"批次号"`
|
||||
StockMode int `json:"stockMode" dc:"库存管理模式"`
|
||||
CreatedAt string `json:"createdAt" dc:"创建时间"`
|
||||
UpdatedAt string `json:"updatedAt" dc:"更新时间"`
|
||||
}
|
||||
112
model/dto/wallet/wallet_dto.go
Normal file
112
model/dto/wallet/wallet_dto.go
Normal file
@@ -0,0 +1,112 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// GetWalletByUserIdReq 根据用户ID获取钱包请求
|
||||
type GetWalletByUserIdReq struct {
|
||||
g.Meta `path:"/getWallet" method:"get" tags:"钱包管理" summary:"获取钱包" dc:"根据用户ID获取钱包信息"`
|
||||
|
||||
UserId int64 `json:"userId" v:"required|min:1" dc:"用户ID"`
|
||||
}
|
||||
|
||||
// GetWalletByUserIdResp 根据用户ID获取钱包响应
|
||||
type GetWalletByUserIdResp struct {
|
||||
Data WalletInfo `json:"data"`
|
||||
}
|
||||
|
||||
// WalletInfo 钱包信息
|
||||
type WalletInfo struct {
|
||||
ID int64 `json:"id" dc:"钱包ID"`
|
||||
UserID int64 `json:"userId" dc:"用户ID"`
|
||||
Balance int64 `json:"balance" dc:"余额(分)"`
|
||||
Currency string `json:"currency" dc:"货币类型"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
}
|
||||
|
||||
// CreateWalletReq 创建钱包请求
|
||||
type CreateWalletReq struct {
|
||||
g.Meta `path:"/createWallet" method:"post" tags:"钱包管理" summary:"创建钱包" dc:"为用户创建钱包"`
|
||||
|
||||
UserId int64 `json:"userId" v:"required|min:1" dc:"用户ID"`
|
||||
Currency string `json:"currency" v:"required" dc:"货币类型"`
|
||||
}
|
||||
|
||||
// CreateWalletResp 创建钱包响应
|
||||
type CreateWalletResp struct {
|
||||
Data CreateWalletData `json:"data"`
|
||||
}
|
||||
|
||||
// CreateWalletData 创建钱包数据
|
||||
type CreateWalletData struct {
|
||||
WalletID int64 `json:"walletId" dc:"钱包ID"`
|
||||
}
|
||||
|
||||
// UpdateBalanceReq 更新余额请求
|
||||
type UpdateBalanceReq struct {
|
||||
g.Meta `path:"/updateBalance" method:"post" tags:"钱包管理" summary:"更新余额" dc:"对钱包余额进行收入/支出/冻结/解冻操作"`
|
||||
|
||||
WalletID int64 `json:"walletId" v:"required" dc:"钱包ID"`
|
||||
Amount int64 `json:"amount" v:"required|min:1" dc:"金额(分)"`
|
||||
Type string `json:"type" v:"required|in:income,expense,freeze,unfreeze" dc:"操作类型"`
|
||||
OrderNo string `json:"orderNo" dc:"业务订单号"`
|
||||
TransactionNo string `json:"transactionNo" dc:"钱包交易流水号"`
|
||||
Description string `json:"description" dc:"描述"`
|
||||
ExtraData map[string]interface{} `json:"extraData" dc:"额外数据"`
|
||||
}
|
||||
|
||||
// UpdateBalanceResp 更新余额响应
|
||||
type UpdateBalanceResp struct {
|
||||
Success bool `json:"success"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// GetWalletLogsReq 获取钱包日志请求
|
||||
type GetWalletLogsReq struct {
|
||||
g.Meta `path:"/getWalletLogs" method:"get" tags:"钱包管理" summary:"获取钱包日志" dc:"分页获取钱包操作日志"`
|
||||
|
||||
UserId int64 `json:"userId" v:"required|min:1" dc:"用户ID"`
|
||||
Page int `json:"page" v:"required|min:1" dc:"页码"`
|
||||
PageSize int `json:"pageSize" v:"required|min:1|max:100" dc:"每页大小"`
|
||||
}
|
||||
|
||||
// GetWalletLogsResp 获取钱包日志响应
|
||||
type GetWalletLogsResp struct {
|
||||
Data WalletLogData `json:"data"`
|
||||
}
|
||||
|
||||
// WalletLogData 钱包日志数据
|
||||
type WalletLogData struct {
|
||||
Logs []WalletLogInfo `json:"logs"`
|
||||
Total int `json:"total"`
|
||||
}
|
||||
|
||||
// WalletLogInfo 钱包日志信息
|
||||
type WalletLogInfo struct {
|
||||
ID int64 `json:"id"`
|
||||
OrderNo string `json:"orderNo"`
|
||||
TransactionNo string `json:"transactionNo"`
|
||||
Type string `json:"type"`
|
||||
Amount int64 `json:"amount"`
|
||||
BalanceBefore int64 `json:"balanceBefore"`
|
||||
BalanceAfter int64 `json:"balanceAfter"`
|
||||
Currency string `json:"currency"`
|
||||
Description string `json:"description"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
|
||||
// CreateWalletLogReq 创建钱包日志请求(内部使用)
|
||||
type CreateWalletLogReq struct {
|
||||
UserID int64 `json:"userId"`
|
||||
WalletID int64 `json:"walletId"`
|
||||
OrderNo string `json:"orderNo"`
|
||||
TransactionNo string `json:"transactionNo"`
|
||||
Type string `json:"type"`
|
||||
Amount int64 `json:"amount"`
|
||||
BalanceBefore int64 `json:"balanceBefore"`
|
||||
BalanceAfter int64 `json:"balanceAfter"`
|
||||
Currency string `json:"currency"`
|
||||
Description string `json:"description"`
|
||||
ExtraData map[string]interface{} `json:"extraData"`
|
||||
}
|
||||
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