121 lines
6.0 KiB
Go
121 lines
6.0 KiB
Go
package dto
|
||
|
||
import (
|
||
consts "assets/consts/asset"
|
||
"assets/consts/stock"
|
||
entity "assets/model/entity/asset"
|
||
|
||
"gitea.com/red-future/common/beans"
|
||
"github.com/gogf/gf/v2/frame/g"
|
||
"github.com/gogf/gf/v2/os/gtime"
|
||
)
|
||
|
||
// CreateAssetSkuReq 创建SKU请求
|
||
type CreateAssetSkuReq struct {
|
||
g.Meta `path:"/createAssetSku" method:"post" tags:"SKU管理" summary:"创建SKU" dc:"创建新的资产SKU"`
|
||
|
||
AssetId int64 `json:"assetId" v:"required" dc:"关联资产ID"`
|
||
AssetName string `json:"assetName" v:"required" dc:"关联资产名称"`
|
||
SkuName string `json:"skuName" v:"required" dc:"SKU名称"`
|
||
SpecsCount int `json:"specsCount" v:"required|min:1" dc:"规格数量"`
|
||
SpecsUnit *entity.SpecsUnitKeyValue `json:"specsUnit" v:"required" dc:"规格单位"`
|
||
SpecValues []map[string]interface{} `json:"specValues" dc:"规格值"`
|
||
ImageURL string `json:"imageUrl" v:"required" dc:"SKU主图"`
|
||
Price int `json:"price" v:"required|min:0" dc:"价格(分为单位)"`
|
||
Sort int `json:"sort" v:"required|min:0" dc:"排序"`
|
||
Status consts.AssetSkuStatusType `json:"status" v:"required|in:1,0" dc:"状态"`
|
||
UnlimitedStock bool `json:"unlimitedStock" v:"required" dc:"是否无库存限制"`
|
||
StockMode stock.StockMode `json:"stockMode" dc:"库存管理模式:1-明细模式 2-批次模式"`
|
||
CategoryId int64 `json:"categoryId" dc:"分类ID"`
|
||
CategoryPath string `json:"categoryPath" dc:"分类路径"`
|
||
TenantModuleType beans.TenantModuleType `json:"tenantModuleType" dc:"租户模块类型"`
|
||
}
|
||
|
||
// CreateAssetSkuRes 创建SKU响应
|
||
type CreateAssetSkuRes struct {
|
||
Id int64 `json:"id" dc:"SKU ID"`
|
||
}
|
||
|
||
// UpdateAssetSkuReq 更新SKU请求
|
||
type UpdateAssetSkuReq struct {
|
||
g.Meta `path:"/updateAssetSku" method:"put" tags:"SKU管理" summary:"更新SKU" dc:"更新SKU信息"`
|
||
|
||
Id int64 `json:"id" v:"required" dc:"SKU ID"`
|
||
SkuName string `json:"skuName" dc:"SKU名称"`
|
||
SpecsCount int `json:"specsCount" dc:"规格数量"`
|
||
SpecsUnit *entity.SpecsUnitKeyValue `json:"specsUnit" dc:"规格单位"`
|
||
SpecValues []map[string]interface{} `json:"specValues" dc:"规格值"`
|
||
ImageURL string `json:"imageUrl" dc:"SKU主图"`
|
||
Price int `json:"price" dc:"价格(分为单位)"`
|
||
Sort int `json:"sort" dc:"排序"`
|
||
Stock int `json:"stock" dc:"库存数量"`
|
||
Status consts.AssetSkuStatusType `json:"status" dc:"状态"`
|
||
}
|
||
|
||
// DeleteAssetSkuReq 删除SKU请求
|
||
type DeleteAssetSkuReq struct {
|
||
g.Meta `path:"/deleteAssetSku" method:"delete" tags:"SKU管理" summary:"删除SKU" dc:"删除SKU"`
|
||
Id int64 `json:"id" v:"required" dc:"SKU ID"`
|
||
}
|
||
|
||
// GetAssetSkuModuleReq 获取SKU详情请求
|
||
type GetAssetSkuModuleReq struct {
|
||
g.Meta `path:"/getAssetSkuModule" method:"get" tags:"SKU管理" summary:"获取SKU模块详情" dc:"获取SKU模块详情"`
|
||
Id int64 `json:"id" v:"required" dc:"SKU ID"`
|
||
}
|
||
|
||
// GetAssetSkuModuleRes 获取SKU详情响应
|
||
type GetAssetSkuModuleRes struct {
|
||
AssetId int64 `json:"assetId"`
|
||
ExpireAt *gtime.Time `json:"expireAt"`
|
||
}
|
||
|
||
// GetAssetSkuReq 获取SKU详情请求
|
||
type GetAssetSkuReq struct {
|
||
g.Meta `path:"/getAssetSku" method:"get" tags:"SKU管理" summary:"获取SKU详情" dc:"获取SKU详情"`
|
||
Id int64 `json:"id" v:"required" dc:"SKU ID"`
|
||
}
|
||
|
||
// GetAssetSkuRes 获取SKU详情响应
|
||
type GetAssetSkuRes struct {
|
||
*AssetSkuItem
|
||
ImgAddressPrefix string `json:"imgAddressPrefix"`
|
||
}
|
||
|
||
// ListAssetSkuReq 获取SKU列表请求
|
||
type ListAssetSkuReq struct {
|
||
g.Meta `path:"/listAssetSkus" method:"get" tags:"SKU管理" summary:"获取SKU列表" dc:"分页查询SKU列表,支持多条件筛选"`
|
||
*beans.Page
|
||
Id int64 `json:"id" dc:"SKU ID"`
|
||
AssetId int64 `json:"assetId" v:"required" dc:"资产ID"`
|
||
Status consts.AssetSkuStatusType `json:"status" dc:"状态"`
|
||
Keyword string `json:"keyword" dc:"关键词搜索"`
|
||
MinPrice int `json:"minPrice" dc:"最低价格"`
|
||
MaxPrice int `json:"maxPrice" dc:"最高价格"`
|
||
CategoryPath string `json:"categoryPath" dc:"分类路径"`
|
||
}
|
||
|
||
// ListAssetSkuRes 获取SKU列表响应
|
||
type ListAssetSkuRes struct {
|
||
List []AssetSkuItem `json:"list" dc:"SKU列表"`
|
||
Total int `json:"total" dc:"总数"`
|
||
}
|
||
|
||
type AssetSkuItem struct {
|
||
Id int64 `json:"id"` // SKU ID
|
||
AssetId int64 `json:"assetId"`
|
||
AssetName string `json:"assetName"` // 资产名称
|
||
SkuName string `json:"skuName"` // SKU名称
|
||
SpecsCount int `json:"specsCount"` // 规格数量
|
||
SpecsUnit *entity.SpecsUnitKeyValue `json:"specsUnit"` // 规格单位
|
||
SpecValues []map[string]interface{} `json:"specValues"` // 规格值:{"颜色":"红色","尺寸":"L","时长":"1个月","平台":"抖音"}
|
||
Price int `json:"price"` // 价格(分为单位)
|
||
UnlimitedStock bool `json:"unlimitedStock"` // 是否无库存限制
|
||
Stock int `json:"stock"` // 库存数量
|
||
Sort int `json:"sort"` // 排序
|
||
Status consts.AssetSkuStatusType `json:"status"` // 状态:active/inactive/disabled
|
||
StockMode stock.StockMode `json:"stockMode"` // 库存管理模式:1-明细模式 2-批次模式
|
||
CreatedAt *gtime.Time `json:"createdAt"` // 创建时间
|
||
UpdatedAt *gtime.Time `json:"updatedAt"` // 更新时间
|
||
}
|