49 lines
1.6 KiB
Go
49 lines
1.6 KiB
Go
package common_structure
|
||
|
||
type ProductsIncreaseSoldType = int
|
||
|
||
const (
|
||
ProductsIncreaseSoldTypePaied ProductsIncreaseSoldType = 10 // 已支付
|
||
ProductsIncreaseSoldTypeSent ProductsIncreaseSoldType = 20 // 已发货
|
||
)
|
||
|
||
type ProductsIncreaseSold struct {
|
||
ID uint `json:"id"` // 订单ID
|
||
ProductID uint `json:"product_id"` // 商品ID
|
||
IncreaseSoldType ProductsIncreaseSoldType `json:"increase_sold_type"` // 增加销量类型
|
||
}
|
||
|
||
// StockState 库存增减标识
|
||
type StockState = string
|
||
|
||
const (
|
||
StockStateIncrease StockState = "increase_inventory" // 增加库存
|
||
StockStateDecrease StockState = "reduce_inventory" // 减少库存
|
||
)
|
||
|
||
type ProductsChangeStockType = int
|
||
|
||
const (
|
||
ProductsChangeStockTypePlaced ProductsChangeStockType = 10 // 下单时
|
||
ProductsChangeStockTypeSent ProductsChangeStockType = 20 // 已发货
|
||
)
|
||
|
||
type ProductsChangeStock struct {
|
||
OrderId uint `json:"order_id"`
|
||
State StockState `json:"state"`
|
||
DecreaseChangeStockType ProductsChangeStockType `json:"decrease_change_stock_type"`
|
||
OrderProductsIDs []uint `json:"order_products_ids"` // 对应的订单商品ID集合加减库存,如果为0,整个订单商品加减库存
|
||
|
||
SkuItems []*SkuItem `json:"sku_items"` // 商家修改商品数量使用,旧逻辑兼容
|
||
}
|
||
|
||
type SkuItem struct {
|
||
SkuID uint `json:"sku_id"`
|
||
Num int `json:"num"`
|
||
Remark string `json:"remark"`
|
||
}
|
||
|
||
type ProductsStockWarn struct {
|
||
ID uint `json:"id"` // skuID
|
||
}
|