159 lines
7.0 KiB
Go
159 lines
7.0 KiB
Go
package dto
|
||
|
||
import (
|
||
marketConsts "shop-user-trade/consts/market"
|
||
|
||
"gitea.redpowerfuture.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:"更新时间"`
|
||
}
|